本文整理了Java中com.google.gwt.core.client.GWT.getUncaughtExceptionHandler()
方法的一些代码示例,展示了GWT.getUncaughtExceptionHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GWT.getUncaughtExceptionHandler()
方法的具体详情如下:
包路径:com.google.gwt.core.client.GWT
类名称:GWT
方法名:getUncaughtExceptionHandler
[英]Returns the currently active uncaughtExceptionHandler.
[中]返回当前活动的uncaughtExceptionHandler。
代码示例来源:origin: com.google.gwt/gwt-servlet
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);
}
});
}
}
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
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);
}
}
代码示例来源:origin: org.jboss.errai/errai-bus
@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);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
if (GWT.getUncaughtExceptionHandler() != null) {
代码示例来源:origin: com.google.gwt.google-apis/gwt-ajaxloader
/**
* 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();
}
}
代码示例来源:origin: com.googlecode.gwt-charts/gwt-charts
/**
* 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();
}
}
代码示例来源:origin: com.googlecode.gwtquery/gwtquery
/**
* 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);
}
代码示例来源:origin: com.googlecode.gwtquery/gwtquery
/**
* 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);
}
代码示例来源:origin: com.extjs/gxt
public void onFrameLoad() {
UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler();
if (handler != null) {
onFrameLoadAndCatch(handler);
} else {
onFrameLoadImpl();
}
}
代码示例来源:origin: com.extjs/gxt
public boolean onFormSubmit() {
UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler();
if (handler != null) {
return onFormSubmitAndCatch(handler);
} else {
return onFormSubmitImpl();
}
}
代码示例来源:origin: errai/errai
private void setUncaughtExceptionHandler() {
final UncaughtExceptionHandler replacedHandler = GWT.getUncaughtExceptionHandler();
GWT.setUncaughtExceptionHandler(new ErraiUncaughtExceptionHandler(replacedHandler));
}
代码示例来源:origin: com.googlecode.gwt-measure/gwt-measure
private void hookExceptionHandler() {
GWT.UncaughtExceptionHandler exceptionHandler = GWT.getUncaughtExceptionHandler();
GWT.setUncaughtExceptionHandler(new WrappingExceptionHandler(exceptionHandler));
}
代码示例来源:origin: net.wetheinter/gwt-user
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);
}
});
}
}
}
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
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);
}
});
}
}
}
}
代码示例来源:origin: net.wetheinter/xapi-gwt-inject
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);
}
}
代码示例来源:origin: branflake2267/GWT-Maps-V3-Api
/**
* 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);
}
}
代码示例来源:origin: com.github.branflake2267/gwt-maps-api
/**
* 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);
}
}
代码示例来源:origin: errai/errai
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;
}
}
代码示例来源:origin: errai/errai
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());
}
代码示例来源:origin: errai/errai
/**
* 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);
}
}
内容来源于网络,如有侵权,请联系作者删除!