473,508 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Robust Error Handling

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
Feb 12 '07 #1
4 1952
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

John Wright wrote:
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
Feb 12 '07 #2
On Feb 12, 11:12 am, "John Wright" <riley_wrig...@hotmail.comwrote:
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!

Feb 12 '07 #3
"John Wright" <ri***********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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.
>
John

Feb 12 '07 #4
vb6 had some decent automated errorhandler add-ins

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

FUCK DOTNOT

Feb 13 '07 #5

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

Similar topics

2
3255
by: WSeeger | last post by:
When creating a new class, is it encouraged to always include error handling routines within your LET and GET procedures? It's seems that most text books never seem to include much about error...
6
8438
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
13
4433
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
21
4372
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So...
3
2836
by: Stefan Johansson | last post by:
Hi all I'am moving from Visual Foxpro and have a question regarding "best practice" error handling in vb .net. In VFP I have always used a "central" error handling object in order to have a...
4
1912
by: Al Williams | last post by:
Hi, I have error handling in place throughout my application. I also start the application wrapped in error handling code to catch any unexpected exceptions (i.e. exceptions that occur where I...
0
11553
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access...
9
3280
by: MrDeej | last post by:
Hello guys! We have an SQL server which sometimes makes timeouts and connection errors. And we have an function witch writes and updates data in 2 tables on this server. When the SQL server error...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.