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

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

Introduction

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

Prototype

public String getDescription() 

Source Link

Document

Returns the original JavaScript message of the exception; may be null.

Usage

From source file:client.net.sf.saxon.ce.js.IXSLFunction.java

License:Mozilla Public License

private SequenceIterator evaluateJsFunction(String script, XPathContext context) throws XPathException {
    injectCount++;/*  w  w  w  .j  a va 2s. co m*/
    String fnName = "fnName" + injectCount;
    script = script.trim();
    String fnScript = "function " + fnName + "() { return " + script + "; }";
    JSObjectValue item = new JSObjectValue(jsWindow());
    JavaScriptObject target = (JavaScriptObject) convertToJavaScript(item);

    ScriptInjector.FromString fs = new ScriptInjector.FromString(fnScript);
    fs.setWindow(target);
    fs.inject();
    JavaScriptObject jsArgs = jsArray(0);
    try {
        Object result = getValueFromTypeValuePair(jsCall(target, fnName, jsArgs));
        return convertFromJavaScript(result, context.getConfiguration());
    } catch (JavaScriptException jexc) {
        throw (new XPathException(
                "JavaScriptException: " + jexc.getDescription() + "\noccurred on evaluating:\n" + script));
    }
}

From source file:com.google.appinventor.client.editor.blocks.BlocklyPanel.java

License:Open Source License

/**
 * Load the blocks described by blocksContent into the blocks workspace.
 *
 * @param formJson JSON description of Form's structure for upgrading
 * @param blocksContent XML description of a blocks workspace in format expected by Blockly
 * @throws LoadBlocksException if Blockly throws an uncaught exception
 *//* w w  w  .ja v  a  2 s  . c o m*/
// [lyn, 2014/10/27] added formJson for upgrading
public void loadBlocksContent(String formJson, String blocksContent) throws LoadBlocksException {
    try {
        doLoadBlocksContent(formJson, blocksContent);
    } catch (JavaScriptException e) {
        loadError = true;
        ErrorReporter.reportError(MESSAGES.blocksLoadFailure(formName));
        OdeLog.elog("Error loading blocks for screen " + formName + ": " + e.getDescription());
        throw new LoadBlocksException(e, formName);
    } finally {
        loadComplete = true;
    }
}

From source file:com.google.appinventor.client.editor.blocks.BlocklyPanel.java

License:Open Source License

/**
 * Get code for current blocks workspace
 *
 * @return the code as a String/* ww  w .  j av a2s. c  o  m*/
 * @throws BlocksCodeGenerationException if there was a problem generating code for the target
 * platform
 */
public String getCode(String formJson, String packageName) throws BlocksCodeGenerationException {
    try {
        return doGetYail(formJson, packageName);
    } catch (JavaScriptException e) {
        throw new BlocksCodeGenerationException(e.getDescription(), formName);
    }
}

From source file:com.google.appinventor.client.editor.blocks.BlocklyPanel.java

License:Open Source License

/**
 * Send component data (json and form name) to Blockly for building code for the target REPL.
 *
 * @throws BlocksCodeGenerationException if there was a problem generating the code for the
 * target platform//from w w  w  .  j av a  2 s.c  om
 */
public void sendComponentData(String formJson, String packageName) throws BlocksCodeGenerationException {
    if (!currentForm.equals(formName)) { // Not working on the current form...
        OdeLog.log("Not working on " + currentForm + " (while sending for " + formName + ")");
        return;
    }
    try {
        doSendJson(formJson, packageName);
    } catch (JavaScriptException e) {
        throw new BlocksCodeGenerationException(e.getDescription(), formName);
    }
}

From source file:com.google.appinventor.client.editor.youngandroid.BlocklyPanel.java

License:Open Source License

public static void loadBlocksContentNow(String formName, String formJson, String blocksContent) {
    LoadStatus loadStat = loadStatusMap.get(formName); // should not be null!
    try {/*from  w w w.  j  a  v a 2  s  . c  o m*/
        doLoadBlocksContent(formName, formJson, blocksContent);
    } catch (JavaScriptException e) {
        ErrorReporter.reportError(MESSAGES.blocksLoadFailure(formName));
        OdeLog.elog("Error loading blocks for screen " + formName + ": " + e.getDescription());
        loadStat.error = true;
    }
    loadStat.complete = true;
}

From source file:com.google.appinventor.client.editor.youngandroid.BlocklyPanel.java

License:Open Source License

/**
 * Get Yail code for current blocks workspace
 *
 * @return the yail code as a String/*from ww  w  .  j  a  v  a 2 s  .c om*/
 * @throws YailGenerationException if there was a problem generating the Yail
 */
public String getYail(String formJson, String packageName) throws YailGenerationException {
    if (!blocksInited(formName)) {
        throw new YailGenerationException("Blocks area is not initialized yet", formName);
    }
    try {
        return doGetYail(formName, formJson, packageName);
    } catch (JavaScriptException e) {
        throw new YailGenerationException(e.getDescription(), formName);
    }
}

From source file:com.google.appinventor.client.editor.youngandroid.BlocklyPanel.java

License:Open Source License

/**
 * Send component data (json and form name) to Blockly for building
 * yail for the REPL.//w  ww.  java2 s  .  c  o m
 *
 * @throws YailGenerationException if there was a problem generating the Yail
 */
public void sendComponentData(String formJson, String packageName) throws YailGenerationException {
    if (!currentForm.equals(formName)) { // Not working on the current form...
        OdeLog.log("Not working on " + currentForm + " (while sending for " + formName + ")");
        return;
    }
    if (!blocksInited(formName)) {
        throw new YailGenerationException("Blocks area is not initialized yet", formName);
    }
    try {
        doSendJson(formName, formJson, packageName);
    } catch (JavaScriptException e) {
        throw new YailGenerationException(e.getDescription(), formName);
    }
}

From source file:com.google.code.gwt.geolocation.client.impl.GeolocationImplGears.java

License:Apache License

private void handleGearsError(PositionCallback callback, JavaScriptException jse) {
    String message = jse.getDescription();
    // Very annoying bug in Gears: Sometimes the Gears call fails with a
    // message "Null or undefined passed for required argument 1."
    boolean gearsBug = (message != null && message.indexOf("Null or undefined passed") == 0);
    handleError(callback, PositionError.create(gearsBug ? 0 : 1, message));
    if (gearsBug) {
        logMessage("Stumbled upon a Gears bug - please report to GWT Mobile WebKit project team! "
                + jse.getMessage());/*from  w ww.j a  v  a 2 s.c o m*/
    }
}

From source file:com.parabay.client.gears.Database.java

License:Apache License

public void transaction(TransactionCallback callback) throws DatabaseException {
    try {//  ww w  .  j av  a  2s.co m
        uncheckedTransaction(callback);
    } catch (JavaScriptException ex) {
        throw new DatabaseException(ex.getDescription(), ex);
    }
}

From source file:org.rest.client.storage.indexeddb.IDBDatabaseException.java

License:Apache License

public IDBDatabaseException(JavaScriptException exception) {
    super(exception.getDescription(), exception);
    Log.error("Error in ndexedDB", exception);
    Object jso = exception.getThrown();
    if (jso == null) {
        code = UNKNOWN_ERR;/*from  www . ja  v  a  2 s.  c  om*/
    } else {
        code = getErrorCode(jso);
    }
}