Robust Error Handling

J

John Wright

I need some good ideas or references for robust error handling in VB.NET.
I am using try catch but find myself using the generic exception handler. I
would like to get more precise error handling so I can take appropriate
action and display user friendly error messages back to the client. The
problem I am getting is determining which error types can be thrown for each
function/sub and handling them. Is there a way to determine all the
possible error types to catch and handle them? Or should I write a generic
error handling routine to pass back all errors through an event? Any
suggestions would be great.

John
 
T

tomb

The various sub-classes of exceptions are categorized according to the
type of error. For instance, File IO exceptions, Numerical exceptions,
and the like. What you will focus on in any procedure will depend on
what is actually taking place there.

The last exception catch, however, should always be the generic
Exception, so nothing will slip by unhandled by mistake.

T
 
L

lord.zoltar

I need some good ideas or references for robust error handling in VB.NET.
I am using try catch but find myself using the generic exception handler. I
would like to get more precise error handling so I can take appropriate
action and display user friendly error messages back to the client. The
problem I am getting is determining which error types can be thrown for each
function/sub and handling them. Is there a way to determine all the
possible error types to catch and handle them? Or should I write a generic
error handling routine to pass back all errors through an event? Any
suggestions would be great.

John

I sometimes write my own exception handling class. I always use the
Excetion in my try..catch blocks, and then when I catch an Exception,
I pass it (and sometimes an address of a delegate in the calling
class, if lots of extra work needs to be done for cleanup) to my own
exception handling class to decide which error message and which style
dialogue to display.
That way, all IO exceptions (for example) can be handled in the same
way in the same place.
This I find works best for large applications, but to each his/her own!
 
M

Michael C

John Wright said:
I need some good ideas or references for robust error handling in VB.NET. I
am using try catch but find myself using the generic exception handler. I
would like to get more precise error handling so I can take appropriate
action and display user friendly error messages back to the client. The
problem I am getting is determining which error types can be thrown for
each function/sub and handling them. Is there a way to determine all the
possible error types to catch and handle them? Or should I write a generic
error handling routine to pass back all errors through an event? Any
suggestions would be great.

Download reflector so you can find everything that inherits from exception.
 
L

Larry Linson

vb6 had some decent automated errorhandler add-ins

I think that MZTOOLS had one; as did the Office 2000 developers
edition

**** DOTNOT
 

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

Top