Improve render exception error messages
When exceptions are encountered during layout rendering, the user experience isn't very good - the exceptions are sent to the IDE log, and the layout editor view adds the error message from the exception (which can sometimes be something like just "2", which is the case for an ArrayIndexOutOfBoundsException for example). This changeset improves this a bit: * First, when the error message is just an exception error message, it's prefixed by a message stating that an exception was raised during layout rendering. * Second, the first exception encountered is now shown in the layout editor itself. Only the frames that are part of the android view hierarchy is shown; all the frames from layoutlib and on down into the IDE are omitted. Frames that are probably part of the user's code (meaning they're not in the android.* or java.* namespaces) are hyperlinkable. * This also includes exceptions encountered during class initialization. In this case, the tip message that View#isInEditMode can be used to do conditional code is displayed in bold. This changeset also fixes some bugs in the SourceRevealer such that it can handle constructors, and such that it will use the line number to pinpoint a line within a method (as long as the line number is in the correct range). Change-Id: I43b635eb24b8e0e64988958c56bdb7dbc1af7221
Loading
Please sign in to comment