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

wjoe invalid at example.com
Wed Jun 3 09:22:46 UTC 2020


On Tuesday, 2 June 2020 at 13:58:13 UTC, Bienlein wrote:
> 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:
>>>[...]
>>
>> 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

That was a good read. Thank you.


More information about the Digitalmars-d-learn mailing list