My current setup involves running Javascripts through the JSR-223 script engine within JRE6. These scripts have the ability to access Java code and objects. In case an exception is generated by the Java code called from a JavaScript, the ScriptEngine will throw a ScriptException.
I am aiming to retrieve the Java exception that triggered the JavaScript exception.
In the JavaScript, I can catch the exception and check the javaException field of the exception:
try
{
.
}
catch (e)
{
e.javaException.printStackTrace();
}
Unfortunately, I do not have direct control over the JavaScript itself, only its execution via the ScriptEngine. Is there a method to obtain the "inner" Java exception from the ScriptException?
It seems that if I were using Rhino, the RhinoException may have included a Java exception. However, the RhinoException is not accessible through the JSR-223 API.