On Wed, 20 Nov 2019 at 20:13, Emil Dotchevski via Boost-users
On Wed, Nov 20, 2019 at 2:50 AM Mathias Gaunard via Boost-users
wrote: On Mon, 18 Nov 2019 at 23:55, Nat Goodspeed via Boost-users
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.ht...
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.