[Mono-list] I cannot seem to find a definitive list of standard C# exceptions
Michael J. Ryan
tracker1_lists at theroughnecks.com
Fri Oct 6 22:01:36 EDT 2006
Xeno Campanoli wrote:
> Sorry if this should be obvious, but isn't there a URL somewhere where I
> can find a list of 20 or so standard exceptions, just like exists for Java?
> Thank you for any feedback.
In C# you don't need to handle *EVERY* type of exception that a class *might*
throw, like Java. For the most part, setup generic handlers at *least* for
System.ApplicationException, and possibly System.Exception (depending on your
usage, I've had to do this for stuff in windows a few times).
From there, if you are dealing with databases, add in handling for the
*Exception within your client's namespace. There is generally a base
Exception class for a given section of the namespace structure.
If you are dealing with threading, System.Threading.ThreadAbortException
should be checked for... it really just depends on what you are working with..
3rd party components will vary though, but the above is a general practice.
NOTE: When creating your own project/namespace, you should consider creating a
generic exception class for that project/namespace that inherits the
System.ApplicationException (for projects/applications)
Or System.Exception class when raising exceptions caused from platform
libraries (ie P/Invoke) that should probably not allow the application to
Michael J. Ryan - tracker1(at)theroughnecks(dot)com - www.theroughnecks.net
icq: 4935386 - AIM/AOL: azTracker1 - Y!: azTracker1 - MSN/Win: (email)
More information about the Mono-list