Attribute(s)
Error Handling
Description
Use the errorhandling functionality as described in Details.
Motivation
A standard error handling provides a more user friendly handling of errors and helps developers to troubleshoot problems risen.
Example / Details
The standard errorhandling is based on 2 principle questions:
What kind of information will we gather?
What will we do with this information?
What kind of information will we gather?
When an error occurs it is important to know where it went wrong. Besides knowing where it went wrong it is important to know how the code reached this line. For example, when you have a standard function or sub in your code, you want to know from where this function or sub was called. We will use the following model example.

Every function or sub has it's own errorhandler. This errorhandler will catch the error, add some information and throw a new one. The module which called the function will catch the error and will handle this the same way. At the end the main level will catch and handle the final error. The result is the error and a call track of how we reach the line that occurs the error.
A function or sub will be the following format:'Standard declarations/settings
Dim ModuleName As String
Dim ErrorString As String
RoadModuleName = "<S_Subroutinename>"
If Not Fn_DebugMode Then On Error Goto ErrorHandler
'Declarations
'settings
Exit Sub
ErrorHandler:
'When an error occures, add standard information to the error and throw a new one
ErrorString = Error$ & Chr$(13) & " -->Errornumber=" & Str(Err) & " -->In module:""" &_
ModuleName & """ -->line=" & Erl Error Err, ErrorString
Fn_DebugMode is a function that will check if the application is in debug mode, this will be used in development environments and by troubleshooting. This function is stored in the 'Error Handling' - script library, and based on the keyword 'DebugMode' 'True'/'False')
What will we do with this error information? When we gathered all the information, we have to inform the user, application owner or the application developer. Consider one (or more) of the 5 different logging options:
Messagebox to the user in Notes
Messagebox to the user in Web browser
Logging in the agent log
Logging in a Notes Document
Sending an email.
User friendly errormessage.
When you choose the messageboxes, you can add user friendly (configurable!) information to the user.
Logging in a Notes Document.
When you choose for logging in a document be aware the user needs at least author access with the option create documents. The error logging documents can bestored in a dedicated Logging database or in the applications database itself.
Sending an email.
When you choose for sending an email, provide a way for administrators to configure the email addresses without the need to modify the design.
Take advantage of OpenLog Template to easily track all errors.