Boost logo

Boost Users :

From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2019-11-20 20:58:47


On Wed, 20 Nov 2019 at 20:13, Emil Dotchevski via Boost-users
<boost-users_at_[hidden]> wrote:
>
> On Wed, Nov 20, 2019 at 2:50 AM Mathias Gaunard via Boost-users <boost-users_at_[hidden]> wrote:
>>
>> On Mon, 18 Nov 2019 at 23:55, Nat Goodspeed via Boost-users
>> <boost-users_at_[hidden]> wrote:
>> >
>> > Since the arrival of Boost.Stacktrace, I've been expecting a conventional boost::errinfo_stacktrace helper to join the suite of other boost::errinfo_mumble helpers. Is there a PR open with that?
>>
>> There's already support for it.
>> https://www.boost.org/doc/libs/1_65_1/doc/html/stacktrace/getting_started.html#stacktrace.getting_started.exceptions_with_stacktrace
>>
>> I never got the point of boost.exception though.
>> If you want exception info, just hook into your exception runtime and
>> get all of them, instead of just the ones thrown with the boost
>> exception magic.
>
>
> The point of Boost Exception is to augment exceptions in flight regardless of their exact type. At the point of the throw, you don't typically have all relevant information to put in the exception object, for example when reporting a file read error you don't have the file name available. Boost Exception allows you to add file names and anything else later on.

In practice most uses I have ever seen are just augmenting the
exception at the throw site with a subset of what a stack trace
provides.

In any case catching and rethrowing exceptions at every layer to add
context information as it bubbles up is not really an idiom I would
recommend.
Not only is quite ugly and complexifies control flow, it's also
inefficient and leads to a poor experience when debugging.

It is a better idea to use normal control flow for this.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net