|
|
|
No, you're probably just fine. I'm guessing that toString for NativeException does not do the message right. Shouldn't be hard to fix. Can you come up with a simple test case?
Okay, I think I have figured out what's going on.
We're running it via JSR223 but actually the problem is more general. Trivial example via the JSR223 script engine: public void testJRubyError() throws Exception { ScriptEngineManager manager = new ScriptEngineManager(); manager.getEngineByExtension("rb").eval("raise 'Test'"); } Outputs: javax.script.ScriptException: org.jruby.exceptions.RaiseException So certainly when being printed as a nested exception nothing is showing. But while playing around with other stuff I discovered that it did somewhat work doing it directly: public void testJRubyError() throws Throwable { Output: My intuition says that whereas printStackTrace() has been overridden in RaiseException, this is not what the outer method is calling (I'm guess it's calling getStackTrace() itself... and I bet overriding that is a more foolproof solution than overriding printStackTrace() anyway.) The ideal output as I see it would be something like: javax.script.ScriptException: org.jruby.exceptions.RaiseException Although overriding only getStackTrace() will probably result in getting output closer to what Sun output for Java exceptions. I just fixed this in r7457. RaiseException's Java stack trace will now show the Ruby trace information, which means that wrappers like the JSR223 ScriptException should show that trace. And of course you can access it via getCause().getStackTrace().
|
||||||||||||||||||||||||||||||||||||||||||||
Message from toString() is still missing for me though. It could be that we're doing something wrong.