Java Code Examples for jdk.nashorn.internal.runtime.ECMAException#getException()
The following examples show how to use
jdk.nashorn.internal.runtime.ECMAException#getException() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeError.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { final ScriptObject sobj = Global.checkObject(self); if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { final Object value = getScriptStackString(sobj, (Throwable)exception); if (sobj.hasOwnProperty(STACK)) { sobj.put(STACK, value, false); } else { sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value); } return value; } return UNDEFINED; }
Example 2
Source File: NativeError.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { final ScriptObject sobj = Global.checkObject(self); if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { final Object value = getScriptStackString(sobj, (Throwable)exception); if (sobj.hasOwnProperty(STACK)) { sobj.put(STACK, value, false); } else { sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value); } return value; } return UNDEFINED; }
Example 3
Source File: NativeError.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { final ScriptObject sobj = Global.checkObject(self); if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { final Object value = getScriptStackString(sobj, (Throwable)exception); if (sobj.hasOwnProperty(STACK)) { sobj.put(STACK, value, false); } else { sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value); } return value; } return UNDEFINED; }
Example 4
Source File: NativeError.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { final ScriptObject sobj = Global.checkObject(self); if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { final Object value = getScriptStackString(sobj, (Throwable)exception); if (sobj.hasOwnProperty(STACK)) { sobj.put(STACK, value, false); } else { sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value); } return value; } return UNDEFINED; }
Example 5
Source File: NativeError.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { final ScriptObject sobj = Global.checkObject(self); if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { final Object value = getScriptStackString(sobj, (Throwable)exception); if (sobj.hasOwnProperty(STACK)) { sobj.put(STACK, value, false); } else { sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value); } return value; } return UNDEFINED; }
Example 6
Source File: NativeError.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { final ScriptObject sobj = Global.checkObject(self); if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { final Object value = getScriptStackString(sobj, (Throwable)exception); if (sobj.hasOwnProperty(STACK)) { sobj.put(STACK, value, false); } else { sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value); } return value; } return UNDEFINED; }
Example 7
Source File: NativeError.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { final ScriptObject sobj = Global.checkObject(self); if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { final Object value = getScriptStackString(sobj, (Throwable)exception); if (sobj.hasOwnProperty(STACK)) { sobj.put(STACK, value, false); } else { sobj.addOwnProperty(STACK, Attribute.NOT_ENUMERABLE, value); } return value; } return UNDEFINED; }
Example 8
Source File: NativeError.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { return getScriptStackString(sobj, (Throwable)exception); } return ""; }
Example 9
Source File: NativeError.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { final ScriptObject sobj = Global.checkObject(self); final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 10
Source File: NativeError.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 11
Source File: NativeError.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { final ScriptObject sobj = Global.checkObject(self); final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 12
Source File: NativeError.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { return getScriptStackString(sobj, (Throwable)exception); } return ""; }
Example 13
Source File: NativeError.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 14
Source File: NativeError.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.stack * "stack" property is a string typed value containing JavaScript stack frames. * Each frame information is separated bv "\n" character. * * @param self self reference * * @return value of "stack" property */ public static Object getStack(final Object self) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; if (sobj.has(STACK)) { return sobj.get(STACK); } final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { return getScriptStackString(sobj, (Throwable)exception); } return ""; }
Example 15
Source File: NativeError.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 16
Source File: NativeError.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { final ScriptObject sobj = Global.checkObject(self); final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 17
Source File: NativeError.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { final ScriptObject sobj = Global.checkObject(self); final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 18
Source File: NativeError.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { final ScriptObject sobj = Global.checkObject(self); final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 19
Source File: NativeError.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { final ScriptObject sobj = Global.checkObject(self); final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }
Example 20
Source File: NativeError.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Nashorn extension: Error.prototype.getStackTrace() * "stack" property is an array typed value containing {@link StackTraceElement} * objects of JavaScript stack frames. * * @param self self reference * * @return stack trace as a script array. */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object getStackTrace(final Object self) { final ScriptObject sobj = Global.checkObject(self); final Object exception = ECMAException.getException(sobj); Object[] res; if (exception instanceof Throwable) { res = NashornException.getScriptFrames((Throwable)exception); } else { res = ScriptRuntime.EMPTY_ARRAY; } return new NativeArray(res); }