Throwable class design

rumbu rumbu at rumbu.ro
Wed Jan 30 01:05:21 PST 2013


On Wednesday, 30 January 2013 at 08:44:52 UTC, Jonathan M Davis 
wrote:
>
> Exceptions get rethrown all the time. Heck, that's what happens 
> with finally,
> scope(failure), and scope(exit). It's what you do when you need 
> to react to
> the fact that the exception was thrown (maybe even to the 
> specific exception)
> but aren't going to handle it in that section of code.
>
> Now, mutating the exception before rethrowing is another thing. 
> I'd tend to
> think that that was bad practice, but I suppose that it could 
> be useful upon
> occasion. In general though, if I wanted to add information, 
> I'd wrap the
> caught exception in a new exception and throw that.
>
> - Jonathan M Davis

Exceptions are not rethrown, finally block is executed *after* 
throwing/catching the exception. I don't know the details of the 
scope(*) implementations, but I doubt that they are rethrowing 
any exceptions. Exceptions are propagated, not rethrown with a 
mutated message or field.


More information about the Digitalmars-d mailing list