The Proper Use of Exception Chaining: Caught between two conflicting usecases?
FeepingCreature
feepingcreature at gmail.com
Fri May 3 07:08:45 UTC 2019
On Thursday, 2 May 2019 at 18:34:39 UTC, Meta wrote:
> I don't understand how what I said contradicts what's on that
> page. It seems to agree with what I said, from what I can tell:
>
> A reference to the next error in the list. This is used when a
> new Throwable is thrown from inside a catch block. The
> originally caught Exception will be chained to the new
> Throwable via this field
>
Subtle difference: It says "thrown from inside a *catch* block",
but current exception chaining is for exceptions thrown from
inside a *finally* block.
Btw, I want to take this opportunity to highlight this wonderful
bug I found a few days ago, coincidentally also with exception
chaining: https://issues.dlang.org/show_bug.cgi?id=19831 , when
you throw *and catch* an exception inside a finally block the
runtime gets very confused, and calls the handler for the
*chained* exception - but with the *thrown* exception.
More information about the Digitalmars-d
mailing list