Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards


Class template exception_handler



// In header: <boost/log/utility/exception_handler.hpp>

template<typename SequenceT, typename HandlerT> 
class exception_handler : public type {
  // types
  typedef HandlerT handler_type;  // The exception handler type. 
  typedef void     result_type;   // The handler result type. 

  // construct/copy/destruct
  explicit exception_handler(handler_type const &);

  // public member functions
  void operator()() const;


An exception handler functional object. The handler aggregates a user-defined functional object that will be called when one of the specified exception types is caught.

exception_handler public construct/copy/destruct

  1. explicit exception_handler(handler_type const & handler);

    Initializing constructor. Creates an exception handler with the specified function object that will receive the exception.

exception_handler public member functions

  1. void operator()() const;

    Exception launcher. Rethrows the current exception in order to detect its type and pass it to the aggregated function object.

    [Note] Note

    Must be called from within a catch statement.