Friday, September 11, 2015

Print uncaught exception in SDM

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.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
.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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment