June 2005 Entries

Re-throwing a caught exception

Here is a mistake that I run into every now and then and thought I'd try to shed some light on it. When rethrowing a caught exception, there are two different ways to do it. Each way has very specific repercussions to the data stored in the exception object. First, you can use throw exceptionInstance; and second, you can also use throw; But what are the differences? When you throw a caught exception by actually throwing the exception instance, the first example, the stack trace for that exception...