views:

20

answers:

0

We used to run rhino, but now with Java 6 we want to switch and use the built in JavaScript support. We are injecting Java objects into JavaScript and run methods on them. When something goes wrong -- Exceptions are thrown we want to handle those exceptions. We used to be able to get them by just getCause on the exception but that is no longer the case. We now get a javax.script.ScriptException which doesn't have the exceptions. getCause returns null. All that remains is stored in message part. Of course it is possible to do text parsing on that error message but is that the only solution available?