Andi Vajda wrote:


On Fri, 13 Mar 2009, Michael McCandless wrote:

OK it's great that I can .printStackTrace() to see it...

But shouldn't we override JavaError.__str__ so by default an unhandled exception originating from Java would reveal its Java trace as well? (And presumably vice/versa).

Does that actually work or does it require some deeper messing with Python so that the exception reporting explores the actual Java exception and continues reporting the stacktrace ?

Good question -- I'm really not sure what's the best way to implement it.

I think on exception we should try to provide as much info as possible to aid in debugging. Sometimes, it's a user who sees this exception, copies it into email and sends it off to you for remote debugging.

Oh, in theory, I completely agree with you. Last time I looked at implementing this it wasn't trivial. Maybe, I missed the obvious ?

Even if overriding __str__ thus worked here, Java is not making it trivial to get a stacktrace as a String (you have to have PrintWriter and StringWriter available to you). Similarly, the JNI ExceptionDescribe() C++ function prints to stderr, it doesn't give you a string.

So, what needs to be done instead is bend Python to do the right thing when reporting the stacktrace of the JavaError python exception and that looked non-trivial last time I looked into it.

Yeah it does not sound easy. I'll at least open an issue for it... this certainly shouldn't block 2.4.1.

Mike

Reply via email to