Search in sources :

Example 1 with JsonParserException

use of playn.core.json.JsonParserException in project playn by threerings.

the class HtmlJson method parse.

@Override
public Object parse(String json) throws JsonParserException {
    try {
        JavaScriptObject jsonParse = jsonParse(json);
        if (!isValueObject(jsonParse))
            throw new JsonParserException(null, "Input JSON was not an object", -1, -1, -1);
        HtmlObject object = (HtmlObject) unwrap0(jsonParse);
        return object;
    } catch (JavaScriptException e) {
        throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1);
    }
}
Also used : JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonParserException(playn.core.json.JsonParserException) JavaScriptException(com.google.gwt.core.client.JavaScriptException)

Example 2 with JsonParserException

use of playn.core.json.JsonParserException in project playn by threerings.

the class HtmlJson method parseArray.

@Override
public Array parseArray(String json) throws JsonParserException {
    try {
        JavaScriptObject jsonParse = jsonParse(json);
        if (!isValueArray(jsonParse))
            throw new JsonParserException(null, "Input JSON was not an array", -1, -1, -1);
        HtmlArray array = (HtmlArray) unwrap0(jsonParse);
        return array;
    } catch (JavaScriptException e) {
        throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1);
    }
}
Also used : JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonParserException(playn.core.json.JsonParserException) JavaScriptException(com.google.gwt.core.client.JavaScriptException)

Aggregations

JavaScriptException (com.google.gwt.core.client.JavaScriptException)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 JsonParserException (playn.core.json.JsonParserException)2