Log the UI tree on error

The dump method doesn't actually print anything, just
returns the tree as a string.