C++ Logo

std-proposals

Advanced search

Re: Stacktrace from exception

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Thu, 29 Apr 2021 12:38:04 +0100
On Thu, 29 Apr 2021 at 12:22, Andrey Semashev via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 4/29/21 1:13 PM, Edward Catmur wrote:
> > If you're using exceptions for control flow the compiler will be able to
> > see the whole of the program accessible from the catch block.
>
> I don't see how.
>

Presumably your catch block is empty in that case?

That's far from normal case in my experience. In fact, I'd be hard
> pressed to remember a single time when I used std::nested_exception
> while I'm attaching data to exceptions all the time - literally, on
> every throw, if you count source location.
>

Different experiences, I guess.

> You have the type and the value converted to string (type-erased on
> > construction). That's all you need for diagnostics.
>
> Again, you have the attached value of its original type. And yes, you
> can use it for handling the exception, including for business logic; I
> certainly do this in my code. That is besides formatting all the
> attached data to a string for diagnostics.
>

Again, different use cases. Like I said, I'm writing from the perspective
of an application author who doesn't control the code that's throwing
exceptions.

Received on 2021-04-29 06:38:17