I tried a few methods to print the stack trace properly in SDM when a
JavaScriptException is caught by UncaughtExceptionHandler.
Finally I come up with the code below
GWT.setUncaughtExceptionHandler(e -> {
if (e instanceof UmbrellaException) {
e = e.getCause();
}
if (e instanceof JavaScriptException) {
JavaScriptException jsError = (JavaScriptException) e;
if (jsError.isThrownSet() && jsError.getThrown() instanceof
JavaScriptObject) {
JsObject jsThrown = (JsObject) jsError.getThrown(); // JsObject is
a wrapper of JavaScriptObject
GWT.log(jsThrown.getString("stack"));
return;
}
}
GWT.log(e.getMessage(), e);
});
The basic idea is to print the stack property of a JS Error object. Is
there a better way of doing this?
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.