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

Bienlein ffm2002 at web.de
Tue Jun 2 13:58:13 UTC 2020


On Wednesday, 27 May 2020 at 11:40:00 UTC, Mike Parker wrote:
> On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote:
>> On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote:
>> Could you please elaborate why checked exceptions are more 
>> annoying?
>>
>
> For me, it's because they require all functions that touch them 
> to either try/catch or include an exception specification in 
> its declaration. In my Java days, I ended up just doing what so 
> many others do and adding `throws Exception` or 
> `catch(Exception)` to avoid having to handle multiple exception 
> types. Most of the time, I didn't care what specific sort of 
> exception was thrown.

Because of the problems with checked exceptions they were 
deliberately left out in C#. Here is an interview with Anders 
Hejlsberg, the creator of C# at MS, where he explains the reasons 
for this decision: https://www.artima.com/intv/handcuffs.html


More information about the Digitalmars-d-learn mailing list