From: Leif Åstrand Date: Tue, 10 Apr 2012 11:28:38 +0000 (+0300) Subject: Update #8544 to be more verbose and to show more exceptions X-Git-Tag: 7.0.0.alpha2~102 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=efff4e68706c13b180be331129664fee08c047e7;p=vaadin-framework.git Update #8544 to be more verbose and to show more exceptions --- diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index fabaeddc78..170e949116 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -16,11 +16,9 @@ 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; -import com.vaadin.terminal.gwt.client.ui.VNotification; public class ApplicationConfiguration implements EntryPoint { @@ -574,19 +572,6 @@ public class ApplicationConfiguration implements EntryPoint { * especially end user. It does not work tells just as much. */ VConsole.getImplementation().error(e); - - if (!GWT.isProdMode()) { - e.printStackTrace(); - } - - try { - VNotification.createNotification( - VNotification.DELAY_FOREVER).show( - getExceptionText(e), VNotification.CENTERED, - "error"); - } catch (Exception e2) { - // Just swallow this exception - } } }); @@ -594,24 +579,6 @@ public class ApplicationConfiguration implements EntryPoint { deferredWidgetLoader = new DeferredWidgetLoader(); } - private static final String getExceptionText(Throwable e) { - if (e instanceof UmbrellaException) { - UmbrellaException ue = (UmbrellaException) e; - String text = ""; - for (Throwable t : ue.getCauses()) { - text += getExceptionText(t) + "
"; - } - return text; - } else { - String text = e.getClass().getName(); - String message = e.getMessage(); - if (message != null) { - text += ": " + message; - } - return text; - } - } - /** * Registers that callback that the bootstrap javascript uses to start * applications once the widgetset is loaded and all required information is diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index fea777ff72..c457044ea9 100644 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -54,6 +54,7 @@ import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ui.RootConnector; import com.vaadin.terminal.gwt.client.ui.VLazyExecutor; +import com.vaadin.terminal.gwt.client.ui.VNotification; import com.vaadin.terminal.gwt.client.ui.VOverlay; import com.vaadin.terminal.gwt.client.ui.VWindow; @@ -632,12 +633,23 @@ public class VDebugConsole extends VOverlay implements Console { } return; } - error(Util.getSimpleName(e) + ": " + e.getMessage()); + String exceptionText = Util.getSimpleName(e); + String message = e.getMessage(); + if (message != null && message.length() != 0) { + exceptionText += ": " + e.getMessage(); + } + error(exceptionText); GWT.log(e.getMessage(), e); if (!GWT.isProdMode()) { e.printStackTrace(); } - + try { + VNotification.createNotification(VNotification.DELAY_FOREVER).show( + "

Uncaught client side exception


" + + exceptionText, VNotification.CENTERED, "error"); + } catch (Exception e2) { + // Just swallow this exception + } } public void init() {