Monthly Archives: March 2010

Catching uncaught exceptions within terminate

The handler std::terminate() is called whenever the exception handling mechanism cannot find a suitable catch clause for a thrown exception (and in some other cases. For example, when an exception is thrown during the handling of another exception – see this GotW post about std::uncaught_exception). It is possible to define a custom handler by using std::set_terminate.

In this post we would like to create a terminate handler which will be able to catch the exception that led to its invocation, when there is one.

Continue reading Catching uncaught exceptions within terminate