On Sunday, 14 August 2022 at 02:30:43 UTC, Paul Backus wrote:
On Sunday, 14 August 2022 at 02:07:05 UTC, Ali Çehreli wrote:
This automatic "combining" of exceptions happens for cleanup
code like scope(exit). (I remember bug(s) for scope(failure).):
To be precise, an exception thrown inside a 'finally' block
gets chained onto the previous exception, but an exception
thrown inside a 'catch' block does not. scope(exit) and
scope(failure) are just syntax sugar for 'finally' and 'catch',
respectively.
I wish the compiler would rewrite scope(failure) to use chained
exceptions. Otherwise any exceptions thrown within scope(failure)
can end up losing information about what was the original
exception that was thrown.