Error Handling with Logging

Some developers write code to insert an error log record into a table when an error occurs. The idea is to be able to analyze when and where errors have occurred by querying this table long after the errors happened. However, this technique has some issues.

□ Access does not provide a way to determine the name of the procedure that is currently running. Since any error logging routine needs to know which procedure caused the error, you would need to manually code the name of the current procedure into each error routine. This is laborintensive and prone to errors.

□ The benefit of error logging is questionable, since few errors should be happening after your code has been tested and delivered. Errors should be rare enough that your users will let you know when they happen. You can always ask them to capture a screenshot if you want to see the details.

The bottom line is that we don't recommend spending the time to log unexpected errors to a table. This is one of those cases where the benefits usually don't outweigh the costs.

0 0

Post a comment