下面列出了怎么用com.google.gwt.core.client.GWT.UncaughtExceptionHandler的API类实例代码及写法,或者点击链接到github查看源代码。
private static void doReportStacktrace(Exception exception) {
// Defer without $entry to bypass some of GWT's exception handling
deferWithoutEntry(() -> {
// Bypass regular exception reporting
UncaughtExceptionHandler originalHandler = GWT
.getUncaughtExceptionHandler();
GWT.setUncaughtExceptionHandler(
ignore -> GWT.setUncaughtExceptionHandler(originalHandler));
// Throw in the appropriate way
if (exception instanceof JavaScriptException) {
// Throw originally thrown instance through JS
jsThrow(((JavaScriptException) exception).getThrown());
} else {
throw exception;
}
});
}
public void onModuleLoad() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable e) {
Throwable u = ToolBox.unwrap(e);
sLogger.log(Level.WARNING, MESSAGES.failedUncaughtException(u.getMessage()), u);
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
onModuleLoadDeferred();
}
});
}
@Override
public void onModuleLoad() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
GWT.log("Uncaught Exception", e);
}
});
// TODO refactor startup to be more explicit
getPropertiesManager(); // creates singleton
}
@Override
public void onModuleLoad() {
if (RootPanel.get("loadingwrapper-login") == null)
return;
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable caught) {
SC.warn("Error", caught.getMessage());
}
});
instance = this;
declareShowLostDialog(this);
// Tries to capture locale parameter
final String lang = Util.detectLocale();
I18N.setLocale(lang);
// Tries to capture tenant parameter
final String tenant = Util.detectTenant();
// Get grid of scrollbars, and clear out the window's built-in margin,
// because we want to take advantage of the entire client area.
Window.enableScrolling(false);
Window.setMargin("0px");
InfoService.Instance.get().getInfo(I18N.getLocale(), tenant, true, new AsyncCallback<GUIInfo>() {
@Override
public void onFailure(Throwable error) {
SC.warn(error.getMessage());
}
@Override
public void onSuccess(final GUIInfo info) {
CookiesManager.saveRelease(info);
I18N.init(info);
WindowUtils.setTitle(info, null);
Feature.init(info);
Session.get().setInfo(info);
WindowUtils.setFavicon(info);
if ("mobile".equals(Util.getJavascriptVariable("j_layout")))
loginPanel = new MobileLoginPanel(info);
else
loginPanel = new LoginPanel(info);
Login.this.showLogin();
}
});
}
/** @return the uncaught exception handler to install. */
protected UncaughtExceptionHandler createUncaughtExceptionHandler() {
// Use GWT's one by default.
return GWT.getUncaughtExceptionHandler();
}
private ErrorHandler(UncaughtExceptionHandler next) {
this.next = next;
}
/** @return the uncaught exception handler to install. */
protected UncaughtExceptionHandler createUncaughtExceptionHandler() {
// Use GWT's one by default.
return GWT.getUncaughtExceptionHandler();
}
private ErrorHandler(UncaughtExceptionHandler next) {
this.next = next;
}
/** @return the uncaught exception handler to install. */
protected UncaughtExceptionHandler createUncaughtExceptionHandler() {
// Use GWT's one by default.
return GWT.getUncaughtExceptionHandler();
}