From 4144a02d5dbf972043a898379c24326286fbfad6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Wed, 21 Mar 2012 14:12:52 +0200 Subject: [PATCH] Improve notification for uncaught UmbrellaException --- .../gwt/client/ApplicationConfiguration.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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 -- 2.39.5