Throwing a new exception while throwing an old exception

Posted by FredOverflow on Stack Overflow See other posts from Stack Overflow or by FredOverflow
Published on 2010-04-26T20:48:29Z Indexed on 2010/04/26 21:03 UTC
Read the original article Hit count: 626

Filed under:
|
|

If a destructor throws in C++ during stack unwinding caused by an exception, the program terminates. (That's why destructors should never throw in C++.)

If a finally block is entered in Java because of an exception in the corresponding try block and that finally block throws another exception, the first exception is silently swallowed.

This question crossed my mind: Could a programming language handle multiple exceptions being thrown at the same time? Would that be useful? Have you ever missed that ability? Is there a language that already supports this? Is there any experience with such an approach?

Any thoughts?

© Stack Overflow or respective owner

Related posts about exception-handling

Related posts about c++