Checked Exceptions

  • Thread starter Thread starter Andy Fish
  • Start date Start date
A

Andy Fish

Hi,

I've been doing a lot of Java programming recently and just getting
into C# a bit more, and I find the lack of checked exceptions very
disturbing. It gives me a funny feeling like driving a car without a
seatbelt, and makes me worry that I am not processing error cases
correctly.

Is this normal? Any java gurus have some advice for moving to C#?

Is it actually worth defining your own Exception classes to the extent
you would in Java, or do you just throw Exception when anything goes
wrong?

Andy
 
Andy Fish said:
I've been doing a lot of Java programming recently and just getting
into C# a bit more, and I find the lack of checked exceptions very
disturbing. It gives me a funny feeling like driving a car without a
seatbelt, and makes me worry that I am not processing error cases
correctly.

Is this normal? Any java gurus have some advice for moving to C#?

The feeling is entirely normal - it mostly goes away over time.
Is it actually worth defining your own Exception classes to the extent
you would in Java, or do you just throw Exception when anything goes
wrong?

I use them similarly to how I do in Java - but using
ApplicationException as the normal base class rather than Exception.
 
Interesting... we'll have to see how that gets reflected in the future
docs.

Agreed. I think this is a work-in-progress. There's still a lot of
unfinished work in the organization of the exception hierarchy, and error
handling in general, really. Checked exceptions were not the answer, but
neither is the current state.
 
Back
Top