What makes up a robust Error Handler?

llyal

Registered User.
Local time
Today, 15:51
Joined
Feb 1, 2000
Messages
72
What makes up a robust Error Handler?

To those experienced: what would make up a robust Error Handler, or a method for robust error handling? Example, MS Access wizards generate:

On Error GoTo Err_Event
(VB Code here)
Exit_Event:
Exit Sub
Err_Event:
MsgBox Err.Description
Resume Exit_Event

Is this all that is required for all my error handling needs?

Thank you!

Llyal
 
For handling errors I will say yes. For tracking errors I have to say no.

I hate typing the same thing over and over again. So I have found that the best solution is to create a Module for my Error Proceedures.

The First Sub is Just the Error Information.

Public Sub ErrMsg(byVal lErr as Long, byVal stErr as string, Optional stMsg as string ="",Optional lHelpIndex as Long = 0)

msgbox stMsg & iif(stmsg<>"",vbcrlf,"") & "The following Error Occurred: " & lErr & vbcrlf & stErr,vbOkOnly+vbInformation,"My Application Name",lHelpIndex

End sub

By calling this I have standardized my Error Msg and I can also now trap for errors that I know can occur.

Also I add a Proceedure to write to an Error Log. I use the Screen.ActiveControl and Screen.ActiveForm to help me determine where the error occured. If you set up the ErrMsg proceedure writing to the log is a simple as adding that line of code to the ErrMsg Proceedure.

As you can see Error Trapping is only half the issue. Error Trapping must be usefull enough to allow the programmers some insight on what went wrong later when users are running full boar. That is what makes up a good Error Handler.
 

Users who are viewing this thread

Back
Top Bottom