From: Leif Åstrand Date: Wed, 21 Mar 2012 12:12:52 +0000 (+0200) Subject: Improve notification for uncaught UmbrellaException X-Git-Tag: 7.0.0.alpha2~291 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4144a02d5dbf972043a898379c24326286fbfad6;p=vaadin-framework.git Improve notification for uncaught UmbrellaException --- diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index fac6cfc40c..26a1329212 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -15,6 +15,7 @@ import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArrayString; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; +import com.google.gwt.event.shared.UmbrellaException; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Timer; import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector; @@ -562,8 +563,9 @@ public class ApplicationConfiguration implements EntryPoint { try { VNotification.createNotification( - VNotification.DELAY_FOREVER).show(e.getMessage(), - VNotification.CENTERED, "error"); + VNotification.DELAY_FOREVER).show( + getExceptionMessage(e), VNotification.CENTERED, + "error"); } catch (Exception e2) { // Just swallow this exception } @@ -574,6 +576,19 @@ public class ApplicationConfiguration implements EntryPoint { deferredWidgetLoader = new DeferredWidgetLoader(); } + private static final String getExceptionMessage(Throwable e) { + if (e instanceof UmbrellaException) { + UmbrellaException ue = (UmbrellaException) e; + String message = ""; + for (Throwable t : ue.getCauses()) { + message += getExceptionMessage(t) + "
"; + } + return message; + } else { + return e.getMessage(); + } + } + /** * Registers that callback that the bootstrap javascript uses to start * applications once the widgetset is loaded and all required information is