Boost logo

Boost :

Subject: Re: [boost] [exception] Virtual inheritance with nodefaultconstructors
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-05-14 13:29:41


On Wed, May 13, 2009 at 11:26 PM, Adam Badura <abadura_at_[hidden]> wrote:
>   Currently we can chain exceptions with boost::exception by constructing a
> new boost::exception and injecting to it error_info<struct
> nested_exception_tag, exception_ptr> with exception taken by
> current_exception. However at the catch site there is little we can do with
> exception_ptr without rethrowing it to catch it and print diagnostic data.
>   How about allowing diagnostic data for exception_ptr?

If you don't insist on the diagnostic message to be user-friendly,
just use current_exception_diagnostic_information:

boost::exception_ptr p;
...
try
{
  boost::rethrow_exception(p);
}
catch(...)
{
  std::cerr << boost::current_exception_diagnostic_information();
}

You can also catch( boost::exception & ), in which case you can use
get_error_info to probe the exception for data. You can't do better
than that without *knowing* what the exception is and what it
indicates in your particular program.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk