Error handling

BeeJayEff

Registered User.
Local time
Today, 01:23
Joined
Sep 10, 2013
Messages
198
I want to beef up the error handling and logging in an application. Currently most procedures which have any substance use the On Error GoTo ErrorHandler ... ExitProcedure technique, with individual MsgBoxes reporting the procedure name and relevant parameters.

I would like to implement a generic error reporting and logging approach, but am aware of the problem with being unable to access the current procedure name and calling stack programmatically. I am also aware of the mztools approach, but would prefer to avoid a third-party tool.

The scheme I am thinking of would use three global variables to hold the names of the current Form, Control and Event. I don't want to have to trap every case of exiting a form (possibly in an error case), so propose using the Form's Activate handler to set the Form name. Every Form, however trivial, would have that handler. Each Control's Event handler would set the Control and Event name globals. I would then call my generic error handler after the ErrorHandler label (passing any specific parameters as well), but would not need to worry about identifying the procedure at that point.

Will that work - in particular, are there circumstances where I might end up reporting an error as coming from the wrong procedure ?
 
check northwind's sample db. it has an error handler class or module there.
 

Users who are viewing this thread

Back
Top Bottom