Example usage for com.google.gwt.core.client JavaScriptException getException

List of usage examples for com.google.gwt.core.client JavaScriptException getException

Introduction

In this page you can find the example usage for com.google.gwt.core.client JavaScriptException getException.

Prototype

public JavaScriptObject getException() 

Source Link

Document

Returns the original JavaScript the exception; may be null.

Usage

From source file:org.gwtnode.dev.debug.SessionHandler.java

License:Apache License

public InvokeResult invoke(String methodName, Value<?> thisObj, Value<?>... args) {
    JavaScriptReturningFunction<Object> function;
    Object nativeThis = getJavaScriptObjectFromValue(thisObj);
    if (nativeThis != null) {
        function = JavaScriptUtils.getProperty((JavaScriptObject) nativeThis, methodName).cast();
    } else {/* www .  j a  v a  2  s.  c o m*/
        function = JavaScriptUtils.getProperty(Global.get(), methodName).cast();
    }
    Object result;
    boolean exception = false;
    try {
        Object[] nativeArgs = new Object[args.length];
        for (int i = 0; i < args.length; i++) {
            nativeArgs[i] = getJavaScriptObjectFromValue(args[i]);
        }
        result = function.apply(nativeArgs);
    } catch (JavaScriptException e) {
        result = e.getException();
        exception = true;
    }
    return new InvokeResult(getValueFromJavaScriptObject(result), exception);
}

From source file:org.gwtnode.modules.xmldom.w3c.DOMException.java

License:Apache License

@SuppressWarnings("deprecation")
public static final DOMException create(JavaScriptException exception) {
    DOMException result;//from   ww  w. j  a v a 2  s  .  c  o m
    if (exception != null) {
        JavaScriptObject e = exception.getException();
        if (e != null) {
            result = e.cast();
            String m = result.message();
            if (m == null || m.isEmpty())
                result.message(exception.getMessage());
        } else {
            result = JavaScriptObject.createObject().cast();
            result.message(exception.getMessage());
        }
    } else
        result = JavaScriptObject.createObject().cast();
    return result;
}

From source file:org.sigmah.offline.indexeddb.IndexedDBException.java

License:Open Source License

public IndexedDBException(JavaScriptException e) {
    this((DOMError) e.getException());
}