Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] review
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2016-12-15 20:30:50

On Thu, Dec 15, 2016 at 4:53 PM, Robert Ramey <ramey_at_[hidden]> wrote:

> On 12/15/16 3:33 PM, Emil Dotchevski wrote:
> It seems that it's in there to support other users who do use boost
>>> exception. Which raises the question of why that is my problem. After
>>> not
>>> getting any traction I did post a patch which would permit support boost
>>> exception without having to make any changes in boost::throw_exception.
>> I'm extremely interested in this, I do want to implement Boost Exception
>> non-intrusively if possible. Can I see code?
> This was discussed in a thread
> td4631441i140.html#a4631898

As I pointed out in my response there, this is not equivalent to what Boost
Exception does. You are catching one exception object and throwing another,
specifically you catch(...) and then throw a new object of the unrelated
type exception_wrapper<>.

To emulate the semantics of Boost Exception non-intrusively, you have to be
able to do something like this:

  //somehow access the current exception object and associate arbitrary
data with it
  throw; //re-throw the original exception object, not a new one.

With Boost Exception this works like so:

catch( boost::exception & e )
  e << my_error_info(....);

The problem is that this only works for exceptions of types that derive
from boost::exception. The boost::throw_exception class template does
NOTHING more than inject boost::exception as a base to the type used to
instantiate it, and only if it isn't a base already.


Boost list run by bdawes at, gregod at, cpdaniel at, john at