public void onModuleLoad() { impl.configureClientSideLogging(); if (impl.loggingIsEnabled()) { if (GWT.getUncaughtExceptionHandler() == null) { final Logger log = Logger.getLogger(LogConfiguration.class.getName()); GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { log.log(Level.SEVERE, e.getMessage(), e); } }); } } } }
private static void reportUncaughtException( Throwable e, boolean reportSwallowedExceptionToBrowser) { if (Impl.uncaughtExceptionHandlerForTest != null) { Impl.uncaughtExceptionHandlerForTest.onUncaughtException(e); } UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler(); if (handler != null) { if (handler == Impl.uncaughtExceptionHandlerForTest) { return; // Already reported so we're done. } // TODO(goktug): Handler might throw an exception but catching and reporting it to browser // here breaks assumptions of some existing hybrid apps that uses UCE for exception // conversion. We don't have an alternative functionality (yet) and it is too risky to include // the change in the release at last minute. handler.onUncaughtException(e); return; // Done. } // Make sure that the exception is not swallowed if (GWT.isClient() && reportSwallowedExceptionToBrowser) { reportToBrowser(e); } else { System.err.print("Uncaught exception "); e.printStackTrace(System.err); } }
@Override public void callback(final Message message) { final String errorTo = message.get(String.class, MessageParts.ErrorTo); if (errorTo == null || DefaultErrorCallback.CLIENT_ERROR_SUBJECT.equals(errorTo)) { final Throwable t = message.get(Throwable.class, MessageParts.Throwable); if (GWT.getUncaughtExceptionHandler() != null) { GWT.getUncaughtExceptionHandler().onUncaughtException(t); } else { managementConsole.displayError(message.get(String.class, MessageParts.ErrorMessage), message.get(String.class, MessageParts.AdditionalDetails), null); } } else { message.toSubject(errorTo); message.set(MessageParts.ErrorTo, null); message.sendNowWith(ClientMessageBusImpl.this); } }
if (GWT.getUncaughtExceptionHandler() != null) {
/** * If an uncaught exception handler has been registered, execute the Runnable * in a try/catch block and handle exceptions with the uncaught exception * handler. Otherwise, run the Runnable and do not catch exceptions. * * @param runnable The Runnable to execute. */ public static void runProtected(Runnable runnable) { UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler(); if (handler != null) { try { runnable.run(); } catch (Throwable e) { handler.onUncaughtException(e); } } else { runnable.run(); } }
/** * If an uncaught exception handler has been registered, execute the Runnable * in a try/catch block and handle exceptions with the uncaught exception * handler. Otherwise, run the Runnable and do not catch exceptions. * * @param runnable The Runnable to execute. */ public static void runProtected(Runnable runnable) { UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler(); if (handler != null) { try { runnable.run(); } catch (Throwable e) { handler.onUncaughtException(e); } } else { runnable.run(); } }
/** * Methods fe(...) should be used from asynchronous contexts so as we can * catch the exception and send it to the GWT UncaughtExceptionHandler * They are intentionally final to avoid override them. */ public final boolean fe(Event ev, Object... args) { if (GWT.getUncaughtExceptionHandler() != null) { try { return f(ev, args); } catch (Exception e) { GWT.getUncaughtExceptionHandler().onUncaughtException(e); } return true; } return f(ev, args); }
/** * Methods fe(...) should be used from asynchronous contexts so as we can * catch the exception and send it to the GWT UncaughtExceptionHandler * They are intentionally final to avoid override them. */ public final Object fe(Object... args) { if (GWT.getUncaughtExceptionHandler() != null) { try { return f(args); } catch (Exception e) { GWT.getUncaughtExceptionHandler().onUncaughtException(e); } return true; } return f(args); }
public void onFrameLoad() { UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler(); if (handler != null) { onFrameLoadAndCatch(handler); } else { onFrameLoadImpl(); } }
public boolean onFormSubmit() { UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler(); if (handler != null) { return onFormSubmitAndCatch(handler); } else { return onFormSubmitImpl(); } }
private void setUncaughtExceptionHandler() { final UncaughtExceptionHandler replacedHandler = GWT.getUncaughtExceptionHandler(); GWT.setUncaughtExceptionHandler(new ErraiUncaughtExceptionHandler(replacedHandler)); }
private void hookExceptionHandler() { GWT.UncaughtExceptionHandler exceptionHandler = GWT.getUncaughtExceptionHandler(); GWT.setUncaughtExceptionHandler(new WrappingExceptionHandler(exceptionHandler)); }
public void onModuleLoad() { impl.configureClientSideLogging(); if (impl.loggingIsEnabled()) { if (GWT.getUncaughtExceptionHandler() == null) { final Logger log = Logger.getLogger(LogConfiguration.class.getName()); GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { log.log(Level.SEVERE, e.getMessage(), e); } }); } } } }
public void onModuleLoad() { impl.configureClientSideLogging(); if (impl.loggingIsEnabled()) { if (GWT.getUncaughtExceptionHandler() == null) { final Logger log = Logger.getLogger(LogConfiguration.class.getName()); GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { log.log(Level.SEVERE, e.getMessage(), e); } }); } } } }
public final void onFailure(Throwable reason) { reason.printStackTrace(); GWT.log("Run async failure", reason); if (tries-->0){ dispatch(); }else{ UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler(); if (handler != null) handler.onUncaughtException(reason); } }
/** * process generic handler callback * * @param handler * @param properties * @param formatter */ @SuppressWarnings("rawtypes") // is ugly, but is a cyclic generic type, so suppressed protected static <E extends MapEvent> void onCallback(final MapHandler<E> handler, final Properties properties, final MapEventFormatter<E> formatter) { try { formatEvent(handler, properties, formatter); } catch (Throwable x) { GWT.getUncaughtExceptionHandler().onUncaughtException(x); } }
/** * process generic handler callback * * @param handler * @param properties * @param formatter */ @SuppressWarnings("rawtypes") // is ugly, but is a cyclic generic type, so suppressed protected static <E extends MapEvent> void onCallback(final MapHandler<E> handler, final Properties properties, final MapEventFormatter<E> formatter) { try { formatEvent(handler, properties, formatter); } catch (Throwable x) { GWT.getUncaughtExceptionHandler().onUncaughtException(x); } }
private ErraiUncaughtExceptionHandler assertErraiHandlerSet() throws Exception, AssertionError { try { testErraiUncaughtExceptionHandlerIsSet(); } catch (final AssertionError ae) { throw new AssertionError("Precondition failed.", ae); } final ErraiUncaughtExceptionHandler erraiHandler = (ErraiUncaughtExceptionHandler) GWT.getUncaughtExceptionHandler(); return erraiHandler; } }
public void testErraiUncaughtExceptionHandlerIsSet() throws Exception { assertNotNull("Exception handler should not be null.", GWT.getUncaughtExceptionHandler()); assertEquals("Exception handler should be instance of " + ErraiUncaughtExceptionHandler.class.getSimpleName(), ErraiUncaughtExceptionHandler.class.getName(), GWT.getUncaughtExceptionHandler().getClass().getName()); }
/** * Takes care of reporting exceptions to the console in hosted mode. * * @param listener the listener object to call back. * @param port argument from the callback. */ private static void onErrorImpl(ErrorHandler errorHandler, ErrorEvent event) { UncaughtExceptionHandler ueh = GWT.getUncaughtExceptionHandler(); if (ueh != null) { try { errorHandler.onError(event); } catch (Exception ex) { ueh.onUncaughtException(ex); } } else { errorHandler.onError(event); } }