473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Checked Exceptions

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
Nov 16 '05 #1
4 1098
Andy Fish <aj****@blueyonder.co.uk> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
>
I use them similarly to how I do in Java - but using
ApplicationException as the normal base class rather than Exception.


The MS position on this has changed and they now advocate that custom
exceptions not be derived from ApplicationException - instead, derive from
System.Exception. Brad Abrams blogs a bit on this...

http://blogs.msdn.com/brada/archive/.../25/96251.aspx
Nov 16 '05 #3
David Levine <no****************@wi.rr.com> wrote:
I use them similarly to how I do in Java - but using
ApplicationException as the normal base class rather than Exception.


The MS position on this has changed and they now advocate that custom
exceptions not be derived from ApplicationException - instead, derive from
System.Exception. Brad Abrams blogs a bit on this...

http://blogs.msdn.com/brada/archive/.../25/96251.aspx


Interesting... we'll have to see how that gets reflected in the future
docs.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
> >
The MS position on this has changed and they now advocate that custom
exceptions not be derived from ApplicationException - instead, derive from System.Exception. Brad Abrams blogs a bit on this...

http://blogs.msdn.com/brada/archive/.../25/96251.aspx


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.
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hung Jung Lu | last post by:
Hi, Just ran into this article http://www.mindview.net/Etc/Discussions/CheckedExceptions And I felt kind of reliefed. When I programmed in Java I always thought its usage of "checked...
26
by: OvErboRed | last post by:
I just read a whole bunch of threads on microsoft.public.dotnet.* regarding checked exceptions (the longest-running of which seems to be <cJQQ9.4419 $j94.834878@news02.tsnz.net>. My personal...
9
by: F. GEIGER | last post by:
Hi everybody, I like checked exceptions as provided by Java. No, I don't want to start a thread on that, but ask, if anyone knows of a tool for that. It may be stand-alone, but being plugable...
9
by: Jeff Louie | last post by:
I drank too much coffee last night and came up with a suggestion about how to add checked exceptions to C# http://www.geocities.com/jeff_louie/OOP/oop14.htm Comments expected <g> Regards,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.