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

wjoe invalid at example.com
Wed May 27 10:30:36 UTC 2020


On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote:
> On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote:
>>
>> The problem with catch(Exception) is that it's run time 
>> whereas I'd like to know compile time which exception may 
>> possibly be thrown.
>>
>> So I take it the only way to find out what may be thrown is to 
>> read the source code of the called function(s) and the rat 
>> tail that follows - and to rely on documentation to be 
>> accurate and complete if the source code isn't available.
>>
>> That's sort of annoying.
>
> Checked exceptions are much more annoying.

Could you please elaborate why checked exceptions are more 
annoying?

The only exposure to checked exceptions I had was with Java and I 
always liked and appreciated them.
It's super annoying the fiddle around with catch(Exception) all 
over the place and log unhandled Exceptions and never be sure 
that all exceptions are properly taken care of.



More information about the Digitalmars-d-learn mailing list