Refine search
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); } }
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); } }
@Override public void onUncaughtException(final Throwable e) { userHandlers.forEach(h -> h.accept(e)); oReplaced.ifPresent(h -> h.onUncaughtException(e)); }
private boolean onFormSubmitAndCatch(UncaughtExceptionHandler handler) { try { return onFormSubmitImpl(); } catch (Throwable e) { handler.onUncaughtException(e); return false; } }
private void onFrameLoadAndCatch(UncaughtExceptionHandler handler) { try { onFrameLoadImpl(); } catch (Throwable e) { handler.onUncaughtException(e); } }
/** * If application has own uncaughtExceptionHandler delegates to that. Otherwise wraps exception into * UnhandledException and throws. * @param exception cause */ public void onUncaughtException(Throwable exception) { IncidentReport report = incidentReportFactory.createReport(exception); DeliveryQueue.instance().pushIncident(report); if (handler != null) { handler.onUncaughtException(exception); } else { throw new UnhandledException(exception); } }
public static void reportUncaughtException(Throwable e) { 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()) { reportToBrowser(e); } else { System.err.print("Uncaught exception "); e.printStackTrace(System.err); } }
/** * 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(); } }
public static void reportUncaughtException(Throwable e) { 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()) { reportToBrowser(e); } else { System.err.print("Uncaught exception "); e.printStackTrace(System.err); } }
/** * 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(); } }
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); } }
/** * 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); }
public Object f(Object... args) { Response response = arguments(0); Request request = arguments(1); Object retData = response.getText(); if (retData != null && !"".equals(retData)) { try { if ("xml".equalsIgnoreCase(dataType)) { retData = JsUtils.parseXML(response.getText()); } else if ("json".equalsIgnoreCase(dataType)) { retData = GQ.create(response.getText()); } else { retData = response.getText(); if ("script".equalsIgnoreCase(dataType)) { ScriptInjector.fromString((String) retData).setWindow(window).inject(); } } } catch (Exception e) { if (GWT.isClient() && GWT.getUncaughtExceptionHandler() != null) { GWT.getUncaughtExceptionHandler().onUncaughtException(e); } else { e.printStackTrace(); } } } return new Object[] {retData, "success", request, response}; } }, new Function() {
public void f() { try { // We clean up the returned string to smoothly append it to our document // Note: using '\s\S' instead of '.' because gwt String emulation does // not support java embedded flag expressions (?s) and javascript does // not have multidot flag. String s = arguments(0).toString().replaceAll("<![^>]+>\\s*", "") .replaceAll("</?html[\\s\\S]*?>\\s*", "") .replaceAll("<head[\\s\\S]*?</head>\\s*", "") .replaceAll("<script[\\s\\S]*?</script>\\s*", "") .replaceAll("</?body[\\s\\S]*?>\\s*", ""); // We wrap the results in a div s = "<div>" + s + "</div>"; Ajax.this.empty().append(filter.isEmpty() ? $(s) : $(s).find(filter)); if (onSuccess != null) { onSuccess.setElement(Ajax.this.get(0)); onSuccess.f(); } } catch (Exception e) { if (GWT.getUncaughtExceptionHandler() != null) { GWT.getUncaughtExceptionHandler().onUncaughtException(e); } } } });
/** * 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); }
/** * 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 <T> Promise<T> handleCatchBlockExceptions(final Object rejectedObject) { if (rejectedObject instanceof Error) { final Error error = (Error) rejectedObject; if (!(error.getObject() instanceof Message)) { GWT.getUncaughtExceptionHandler().onUncaughtException( new RuntimeException("Promise.Error did not contain a Message. " + "Something's not right.")); return resolve(); } DEFAULT_RPC_ERROR_CALLBACK.error((Message) error.getObject(), error.getThrowable()); return resolve(); } if (rejectedObject instanceof Throwable) { GWT.getUncaughtExceptionHandler().onUncaughtException((Throwable) rejectedObject); return resolve(); } return reject(rejectedObject); }
private <T> Promise<T> handleCatchBlockExceptions(final Object rejectedObject) { if (rejectedObject instanceof Error) { final Error error = (Error) rejectedObject; if (!(error.getObject() instanceof Message)) { GWT.getUncaughtExceptionHandler().onUncaughtException( new RuntimeException("Promise.Error did not contain a Message. " + "Something's not right.")); return resolve(); } DEFAULT_RPC_ERROR_CALLBACK.error((Message) error.getObject(), error.getThrowable()); return resolve(); } if (rejectedObject instanceof Throwable) { GWT.getUncaughtExceptionHandler().onUncaughtException((Throwable) rejectedObject); return resolve(); } return reject(rejectedObject); }