From e0d084bcdfac782528c5f7f42f7caa9e3e3f7909 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 21 Sep 2010 05:10:16 +0000 Subject: [PATCH] improved logging while setting up logging #5613 svn changeset:15082/svn branch:6.4 --- .../gwt/client/ApplicationConfiguration.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index 3f54d34e39..37b62a447a 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -376,15 +376,6 @@ public class ApplicationConfiguration implements EntryPoint { }; public void onModuleLoad() { - // display some sort of error of exceptions in web mode to debug console - GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { - public void onUncaughtException(Throwable e) { - Console console = VConsole.getImplementation(); - if (console != null) { - console.error(e.getMessage()); - } // else very early phase of init, alert ?? - } - }); // Prepare VConsole for debugging if (isDebugMode()) { @@ -395,6 +386,21 @@ public class ApplicationConfiguration implements EntryPoint { } else { VConsole.setImplementation((Console) GWT.create(NullConsole.class)); } + /* + * Display some sort of error of exceptions in web mode to debug + * console. After this, exceptions are reported to VConsole and possible + * GWT hosted mode. + */ + GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { + public void onUncaughtException(Throwable e) { + /* + * Note in case of null console (without ?debug) we eat + * exceptions. "a1 is not an object" style errors helps nobody, + * especially end user. It does not work tells just as much. + */ + VConsole.getImplementation().error(e.getMessage()); + } + }); initConfigurations(); startNextApplication(); -- 2.39.5