Any way to peek at the exception currently being thrown?

Steven Schveighoffer schveiguy at gmail.com
Fri Jun 4 13:42:31 UTC 2021


On 6/4/21 2:02 AM, 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.
> 
> 

Doesn't that mean that throwing an exception has to stuff the exception 
somewhere in TLS while in flight?

I assumed it was just something stored as a local variable.

-Steve


More information about the Digitalmars-d mailing list