Any way to peek at the exception currently being thrown?

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Fri Jun 4 07:25:06 UTC 2021


On Friday, 4 June 2021 at 06:02:27 UTC, Andrei Alexandrescu wrote:
> On 6/2/21 12:47 PM, Steven Schveighoffer wrote:
>> On 6/2/21 6:03 AM, Andrei Alexandrescu wrote:
>> 
>>> The runtime certainly has that information, so the only 
>>> matter is exposing it via an API.
>> 
>> Seems obvious for an API:
>> 
>> scope(failure, e) // use exception e
>
> I am hoping for an API that would allow picking the current 
> exception from anywhere:
>
> Throwable currentThrowable();
>
> Returns null if none, or the current exception being thrown.

Making exceptions a runtime feature instead of a language feature 
is not a good design.



More information about the Digitalmars-d mailing list