Standard Exceptions... where to find them

  • Thread starter Thread starter Hans De Schrijver
  • Start date Start date
H

Hans De Schrijver

Where can I find a list of pre-defined exceptions for .NET?
Whenever possible, I'd rather use existing exception constants rather than
defining my own, unless no suitable one has been predefined.

Any help would be greatly appreciated.

-- Hans De Schrijver
 
Hans said:
Where can I find a list of pre-defined exceptions for .NET?
Whenever possible, I'd rather use existing exception constants rather
than defining my own, unless no suitable one has been predefined.

Exceptions are objects, not values.

It is recommended that you either forward the exception you've caught or
wrap it in a new ApplicationException.
 
I understand that.
However, what I'm looking for is a list of standard pre-defined errors, like
System.DivideByZeroException, System.ArithmeticException and so on.

-- Hans De Schrijver
 
Hans,
I normally goto the MSDN library to find all the classes in .NET.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/cpref_start.asp

There are no "exception constants", unless you mean the COM interop HR
values.

However! if you would like to get all the Exception classes, I normally
start with System.Exception, then click on Derived classes, then click on
those derived classes and so on.

http://msdn.microsoft.com/library/d...cpref/html/frlrfSystemExceptionClassTopic.asp

Tools such as WinCV (from the .NET SDK) are also useful to search for
classes with Exception in the name.

Hope this helps
Jay
 
Frank Oquendo said:
Exceptions are objects, not values.

It is recommended that you either forward the exception you've caught or
wrap it in a new ApplicationException.

Not if it makes sense as one of the system exceptions.

ApplicationException is being advised *against* from Whidbey onwards
anyway, I believe - basically no-one's found it particularly useful.
 
Back
Top