libsigc++ 3.6.0
exception_catch()

sigc::exception_catch() catches an exception thrown from within the wrapped functor and directs it to a catcher functor.

sigc::exception_catch() catches an exception thrown from within the wrapped functor and directs it to a catcher functor.

This catcher can then rethrow the exception and catch it with the proper type.

Note that the catcher is expected to return the same type as the wrapped functor so that normal flow can continue.

Catchers can be cascaded to catch multiple types, because uncaught rethrown exceptions proceed to the next catcher adaptor.

Examples:
struct my_catch
{
int operator()()
{
try { throw; }
catch (std::range_error e) // catch what types we know
{ std::cerr << "caught " << e.what() << std::endl; }
return 1;
}
}
int foo(); // throws std::range_error
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
ostream cerr
decltype(auto) ptr_fun(T_return(*func)(T_args...))
Creates a functor of type sigc::pointer_functor which wraps an existing non-member function.
Definition ptr_fun.h:109
decltype(auto) exception_catch(const T_functor &func, const T_catcher &catcher)
Definition exception_catch.h:130

The functor that sigc::exception_catch() returns can be passed directly into sigc::signal::connect() or sigc::signal::connect_first().

Example: