]> source.dussan.org Git - vaadin-framework.git/commitdiff
Improve notification for uncaught UmbrellaException
authorLeif Åstrand <leif@vaadin.com>
Wed, 21 Mar 2012 12:12:52 +0000 (14:12 +0200)
committerLeif Åstrand <leif@vaadin.com>
Wed, 21 Mar 2012 12:12:52 +0000 (14:12 +0200)
src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java

index fac6cfc40c2f75acdefd79d2decc6d4688ae7979..26a1329212d20fd7fd181c23ee49047cce2d6698 100644 (file)
@@ -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) + "<br />";
+            }
+            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