Hi,
for some time our app has produced useless stack traces in FF, IE10+11 in case of null pointer exceptions thrown by the browser (TypeError: var is null). After some debugging I have seen that our app uses CollectorLegacy for these browsers because the GWT module had defined <set-property name="compiler.useSourceMaps" value="true"> without any condition on the user.agent value.
After taking a closer look how things work with CollectorLegacy I figured that it must always produces useless stack traces for JavaScriptExceptions and I am wondering if thats a known fact and if GWT can't handle that any better?
Whenever you have a catch block in Java, GWT generates (pseudo code):
catch ($e0) {
$e0 = wrap($e0);
if($e0 instanceof Throwable) {
execute real catch block
} else {
throw unwrap($e0);
}
}
If $e0 is a javascript exception the wrap() call creates a new GWT JavaScriptException and later on when you call getStackTrace() on that exception you will see a stack trace whose root is inside the wrap() function (exception.fnStack Array) and you won't see any of your own code in that stack trace. As an example:
Caused by: java.lang.Throwable: (TypeError) : this.A is null
at com.google.gwt.lang.Exceptions.getCachableJavaScriptException(Exceptions.java:43)
at com.google.gwt.lang.Exceptions.wrap(Exceptions.java:26)
at com.google.web.bindery.event.shared.SimpleEventBus.$doFire(SimpleEventBus.java:173)
... 10 more
In this case taken from our app above the bold line are missing 6 lines of app code that would point to the problem, however CollectorLegacy just swallows all of them because of the wrap() code.
I guess that could be VERY annoying for people supporting IE8+9.
Any thoughts?
-- J.