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

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

Introduction

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

Prototype

public String getName() 

Source Link

Document

Returns the original JavaScript type name of the exception; may be null.

Usage

From source file:com.google.code.gwt.database.client.impl.DatabaseImpl.java

License:Apache License

public Database openDatabase(String shortName, String version, String displayName, int maxSizeBytes)
        throws DatabaseException {
    try {/*from   ww  w.  jav  a  2 s. c  o m*/
        return openDatabase0(shortName, version, displayName, maxSizeBytes);
    } catch (JavaScriptException e) {
        // INVALID_STATE_ERR or SECURITY_ERR
        throw new DatabaseException(e.getName(), e);
    }
}

From source file:com.google.code.gwt.database.client.SQLResultSet.java

License:Apache License

/**
 * @return the row ID of the row that the SQLResultSet object's SQL statement
 *         inserted into the database, if the statement inserted a row. If the
 *         statement inserted multiple rows, the ID of the last row will be
 *         returned. If the statement did not insert a row, then this call
 *         raises a DatabaseException.//  ww w .j a va2 s .  co  m
 */
public final int getInsertId() {
    try {
        return getInsertId0();
    } catch (JavaScriptException e) {
        // INVALID_ACCESS_ERR
        throw new DatabaseException("Could not get insertId from SQLResultSet: " + e.getName(), e);
    }
}

From source file:com.sencha.gxt.core.client.dom.XElement.java

License:sencha.com license

/**
 * Determine whether an element is equal to, or the child of, this element.<br/>
 * <br/>/*from w  ww . jav  a2s . c o m*/
 * This implementation delegates to <code>Node.isOrHasChildImpl(Node)</code>, but catches a scenario
 * in IE9 & IE10 where not all elements support the contains() method used by the deferred binding to
 * <code>DOMImplTrident.isOrHasChildImpl(Node, Node)</code>.
 *
 * @param child the potential child element
 * @return <code>true</code> if the relationship holds
 * @see com.google.gwt.dom.client.Node#isOrHasChild(Node)
 * @see com.google.gwt.dom.client.DOMImplTrident#isOrHasChildImpl(Node, Node)
 */
public final boolean isOrHasChild(XElement child) {
    try {
        return super.isOrHasChild(child);
    } catch (JavaScriptException e) {
        // swallow the exception if it is a manifestation of the IE9 & IE10 bug
        if ((GXT.isIE9() || GXT.isIE10()) && e.getName().equals("TypeError")
                && e.getMessage().contains("'contains'")) {
            return false;
        } else {
            throw e;
        }
    }
}

From source file:playn.html.HtmlAssetManager.java

License:Apache License

private void doXhr(final String fullPath, final ResourceCallback<String> callback) {
    XMLHttpRequest xhr = XMLHttpRequest.create();
    xhr.setOnReadyStateChange(new ReadyStateChangeHandler() {
        @Override// w  w w .j  a va 2s .com
        public void onReadyStateChange(XMLHttpRequest xhr) {
            int readyState = xhr.getReadyState();
            if (readyState == XMLHttpRequest.DONE) {
                int status = xhr.getStatus();
                // status code 0 will be returned for non-http requests, e.g. file://
                if (status != 0 && (status < 200 || status >= 400)) {
                    PlayN.log().error("xhr::onReadyStateChange[" + fullPath + "](readyState = " + readyState
                            + "; status = " + status + ")");
                    callback.error(
                            new RuntimeException("Error getting " + fullPath + " : " + xhr.getStatusText()));
                } else {
                    if (LOG_XHR_SUCCESS) {
                        PlayN.log().debug("xhr::onReadyStateChange[" + fullPath + "](readyState = " + readyState
                                + "; status = " + status + ")");
                    }
                    // TODO(fredsa): Remove try-catch and materialized exception once issue 6562 is fixed
                    // http://code.google.com/p/google-web-toolkit/issues/detail?id=6562
                    try {
                        callback.done(xhr.getResponseText());
                    } catch (JavaScriptException e) {
                        if (GWT.isProdMode()) {
                            throw e;
                        } else {
                            JavaScriptException materialized = new JavaScriptException(e.getName(),
                                    e.getDescription());
                            materialized.setStackTrace(e.getStackTrace());
                            throw materialized;
                        }
                    }
                }
            }
        }
    });

    if (LOG_XHR_SUCCESS) {
        PlayN.log().debug("xhr.open('GET', '" + fullPath + "')...");
    }
    xhr.open("GET", fullPath);

    if (LOG_XHR_SUCCESS) {
        PlayN.log().debug("xhr.send()...");
    }
    xhr.send();
}