protected Object parseEvalReply ( EvalResult result ) { String status = result . getStatus ( ) ; if ( ! status . equals ( "completed" ) ) { if ( status . equals ( "unhandled-exception" ) ) { // Would be great give the JS error here, but it appears that by the // time we callFunctionOnObject the error object has gone... throw new ScopeException ( "Ecmascript exception" ) ; } else if ( status . equals ( "cancelled-by-scheduler" ) ) { // TODO: what is the best approach here? return null ; } } String dataType = result . getType ( ) ; if ( dataType . equals ( "object" ) ) { return result . getObjectValue ( ) ; } else { return parseValue ( dataType , result . getValue ( ) ) ; } }
Parses a reply and returns the following types String presentation of number boolean or string .