What's the best way to find out which exceptions may be thrown ?

Mike Parker aldacron at gmail.com
Wed May 27 09:44:56 UTC 2020


On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote:
> On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote:
>
>>
>> The compiler will complain that bar(int) isn't nothrow.
>>
>> What's the best way to find out which Exceptions aren't 
>> handled inside of foo() for foo to be able to be nothrow 
>> without using a 'catch (Exception){}' catch-all?
>
> `catch(Exception)`.

I should add that if you're only catching specific exceptions in 
a `nothrow` function, then it isn't `nothrow`. You have to catch 
Exception because D does not have exception specifications. I 
would expect the compiler to complain if you try to do otherwise.


More information about the Digitalmars-d-learn mailing list