Saturday, May 24, 2014

Re: SuperDevMode (SDM) and catch basic Exception in Anonymous Classes

First the exception message gives you an idea of what has happened. In your case you have called "length()" on a null object.

In your example if you use breakpoint on uncaught exception you are somewhere in HandlerManager which uses an EventBus to fire events. The problem is that all event handlers (in your case the ClickHandler) will be executed by the EventBus and possible exceptions are recorded. Once all handlers have been executed all recorded exceptions are wrapped by a single UmbrellaException which is the one you are seeing now in your breakpoint.

What you can do now is to inspect the UmbrellaException $e0 in the Scope Variables section of Chrome Dev Tools. If you open up the path $e0 -> causes -> map_0 -> hashCodeMap you will see all the exceptions of all the event handlers stored in that map. All these exceptions have a stackTrace variable containing the JavaScript stack trace including JavaScript file (e.g. <hash>.cache.html), method name and line number. You should be able to look that up in the <hash>.cache.html file.

If you don't know where to set the breakpoint before the exception occurs then SourceMaps don't help you a lot because you need to look at the JavaScript stack trace. Also if you find it annoying to click through the Chrome Dev Tools to inspect the UmbrellaException (which might be large, depending on how many exception have been wrapped by it) you could also log the exception and ALL its contents to console using:

    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
      Logger logger = Logger.getLogger("Uncaught Exception Logger");

      public void onUncaughtException(Throwable e) {
        String json = JsonLogRecordClientUtil.throwableAsJson(e);

      private native String prettify(String json) /*-{
        // will fail in IE6/7
        return $wnd.JSON.stringify($wnd.JSON.parse(json), undefined, 2);

You would need to inherit GWT logging: <inherits name=""/>. You could also send the exception to the server and deobfuscate it back to a Java stack trace using StackTraceDeobfuscator and the symbols map / sourcemap data generated by the GWT compiler (by default stored in war/WEB-INF/deploy). Just keep in mind that UmbrellaException only provides the first wrapped exception in UmbrellaException.getCause(). To deobfuscate everything you would need to go through UmbrellaException.getCauses().

Hope that helps.

-- J.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment