/** * Equivalent to executing "new Error(message)" from JavaScript. * @param cx the current context * @param scope the current scope * @param message the message * @return a JavaScriptException you should throw */ public static JavaScriptException throwError(Context cx, Scriptable scope, String message) { int[] linep = { 0 }; String filename = Context.getSourcePositionFromStack(linep); final Scriptable error = newBuiltinObject(cx, scope, TopLevel.Builtins.Error, new Object[] { message, filename, Integer.valueOf(linep[0]) }); return new JavaScriptException(error, filename, linep[0]); }
/** * Equivalent to executing "new Error(message, sourceFileName, sourceLineNo)" from JavaScript. * @param cx the current context * @param scope the current scope * @param message the message * @return a JavaScriptException you should throw */ public static JavaScriptException throwError(Context cx, Scriptable scope, String message) { int[] linep = { 0 }; String filename = Context.getSourcePositionFromStack(linep); final Scriptable error = newBuiltinObject(cx, scope, TopLevel.Builtins.Error, new Object[] { message, filename, Integer.valueOf(linep[0]) }); return new JavaScriptException(error, filename, linep[0]); }
/** * Equivalent to executing "new Error(message)" from JavaScript. * @param cx the current context * @param scope the current scope * @param message the message * @return a JavaScriptException you should throw */ public static JavaScriptException throwError(Context cx, Scriptable scope, String message) { int[] linep = { 0 }; String filename = Context.getSourcePositionFromStack(linep); final Scriptable error = newBuiltinObject(cx, scope, TopLevel.Builtins.Error, new Object[] { message, filename, Integer.valueOf(linep[0]) }); return new JavaScriptException(error, filename, linep[0]); }
/** * Equivalent to executing "new Error(message)" from JavaScript. * @param cx the current context * @param scope the current scope * @param message the message * @return a JavaScriptException you should throw */ public static JavaScriptException throwError(Context cx, Scriptable scope, String message) { int[] linep = { 0 }; String filename = Context.getSourcePositionFromStack(linep); final Scriptable error = newBuiltinObject(cx, scope, TopLevel.Builtins.Error, new Object[] { message, filename, Integer.valueOf(linep[0]) }); return new JavaScriptException(error, filename, linep[0]); }
(ScriptableObject) ScriptRuntime.newBuiltinObject(cx, scope, TopLevel.Builtins.Error, ScriptRuntime.emptyArgs);