com.google.gwt.ajaxloader.client.ExceptionHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gwt-ajaxloader Show documentation
Show all versions of gwt-ajaxloader Show documentation
The Google API Libraries for Google Web Toolkit is a collection of libraries that provide Java language bindings
for popular Google JavaScript APIs. These libraries make it quick and easy for developers to use these Google
JavaScript APIs with Google Web Toolkit. The libraries are supported by the Google Web Toolkit team.
The newest version!
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.ajaxloader.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
/**
* Helps with the GWT uncaught exception handler.
*/
public abstract class ExceptionHelper {
/**
* 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 ExceptionHelper() {
// do not instantiate
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy