Exception Hierarchy FAQ?

  • Thread starter Thread starter clintonG
  • Start date Start date
C

clintonG

I was wondering if anybody has put together a FAQ documenting the hierarchy
of various exceptions? Trying to learn and remember which to include and
which order to process exceptions is not entertaining :-)

<%= Clinton Gallagher
 
Not sure I understand your request. Are you simply looking for a document
that lists all the exceptions available to use?
 
I'm not clear either.

There's no set order to catch exceptions. You should simply catch what you
can handle. The hierarchy isn't very deep, it's hard to imagine it's causing
any problems. You can use a tool like reflector to see what inherits from
what. so if you want to catch ApplicationException but want to see if
there's something more specific, you could see, using Reflector, what
inherits from it.

Again, the hierarchy isn't very deep/complex however and I doubt you'll ever
really be handling that many exceptions.

Karl
 
Well, yes to Peter in the sense I was wondering if somebody had drafted a
FAQ for exception management that I haven't found yet and AFIK Karl, there
is a specific order we are supposed to use to catch exceptions. Meanwhile,
I'm reading the Exception Management Architecture Guide [1] and appreciate
the comments...

<%= Clinton Gallagher

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/exceptdotnet.asp


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:[email protected]...
 
Well, ur supposed to catch more specific exceptions first..for example, if
you do:

catch (Exception ex)
{
}
catch(SqlException ex)
{
}

the 2nd catch can NEVER execute, since the first one will always catch
whatever the 2nd one could.

But as I say, there's very little hierarchy to the exiting exceptions. Most
inherit directly from Exception, so you don't need to worry about it, just
catch whatever exception you need BEFORE catching System.Exception, and
you'll be alright 95% of the time.

Karl

--
http://www.openmymind.net/



clintonG said:
Well, yes to Peter in the sense I was wondering if somebody had drafted a
FAQ for exception management that I haven't found yet and AFIK Karl, there
is a specific order we are supposed to use to catch exceptions. Meanwhile,
I'm reading the Exception Management Architecture Guide [1] and appreciate
the comments...

<%= Clinton Gallagher

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/exceptdotnet.asp


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top