Rob Rentz

Welcome to my Blogging Paradise

Sponsors

Tags

No tags have been created or used yet.

Blogs I Read

Exceptions and StackTrace

Using the StackTrace within the Exception object is very cool. I am a little confused with one thing though and that is re-throwing an exception. Examining the stack trace within the called method (where the error occurs) reveals the exact line number of the exception - very cool.

From there, I typically just say 'Throw', not re-throwing a new exception, which would then hit the try/catch of the calling method. Looking at the stack trace again here now replaces the originating line number of the error w/ the line number of the 'Throw'.

What I don't understand is how to determine the originating line number of the exception from the "root" method. Heck, I'm not even sure if line numbers will show in a production release build of the code?!?!

I'd love to hear from anyone really familiar with exception handling.

 

Comments

Jerry Pisk said:

You can throw a new exception and save the original as its nested (or inner or whatever it's called) exception instead of re-throwing the original object.
# April 26, 2004 4:58 PM

TrackBack said:

^_^,Pretty Good!
# April 10, 2005 6:24 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)