Correct. Anything without “internal” in it should be fine. On 20 Jun 2014, at 21:36, Greg Brail <[email protected]> wrote:
> Thank you! > > It's my understanding that the "jdk.nashorn.api.scripting" package is > considered fairly stable and using it my code is "OK," so I may use that > technique. > > > On Fri, Jun 20, 2014 at 9:22 AM, A. Sundararajan < > [email protected]> wrote: > >> You can evaluate: >> >> function getScriptTrace() { >> try { >> throw new Error(); >> } catch (e) { >> return e.stack >> } >> } >> >> in your script and call the same from java code using >> javax.script.Invocable.invokeFunction. ("stack" property and other >> related extensions are documented here: https://wiki.openjdk.java.net/ >> display/Nashorn/Nashorn+extensions). >> >> Or if you're okay with nashorn specific extension, you can use this API >> from java code. >> >> public static StackTraceElement[] jdk.nashorn.api.scripting. >> NashornException.getScriptFrames(Throwable th) >> >> Hope this helps, >> -Sundar >> >> On Friday 20 June 2014 09:35 PM, Greg Brail wrote: >> >>> Is there a way in Nashorn or javax.script to get a clean JavaScript-only >>> stack trace (not a Java stack trace, but only containing JavaScript code) >>> out of an exception thrown by a script? I don't see anything in the >>> Nashorn >>> Wiki or javax.script -- apologies if I'm missing something there. >>> >>> For instance, I can get a full Java stack trace when my script fails, but >>> I'd like to ignore all the Java stuff and give users the stack trace that >>> they would get if they were running the "plain" JavaScript natively rather >>> than inside Java. >>> >>> >> > > > -- > *greg brail* | *apigee <https://apigee.com/>* | twitter @gbrail > <http://twitter.com/gbrail>
