PDA

View Full Version : catching an exception


maxxon
1st February 2012, 17:25
I was noticing that when catching an exception, the preceeding stack frame locations (lines) prior to the catch are not listed in the exception string.

Is there a reason for this? There are some ideas that I have where it would be useful in having the entre list. Also, it would be great for debugging.

Thanks,


|\/|x

Gavino
1st February 2012, 18:56
Basically, the error string is built up by the interpreter as the stack unwinds(*) back to the point of the exception handler (try/catch). So it includes all stack frames between those two points, but not any frames enclosing the function that contains the try/catch statement - at that point in the execution, information about those outer frames is not readily available to the parser (whose operation is highly recursive).

(*)This unwinding occurs through a chain of C++ exception handlers.

maxxon
1st February 2012, 22:14
Ah, that's too bad. It makes for slightly tricker debugging and keeps from determining what line you are currently on for other interesting things.


|\/|x