Error Reporting in the Vermont Views Libraries

Whenever an error, either development or runtime, is detected by a function, the function sets a globally-available error code to a non-zero value. This error code is a global variable #defined as VV_ERR. Before the function returns, it will call an error reporting function, if one is installed, when VV_ERR is found to be non-zero.

In the development libraries, the default is to use the VCS error reporting system (see below). You can also use (1) a simple error handler provided by the system or (2) an error function that you write and install. The simple error reporter provided by the system displays a window and displays the error message associated with the error code.

In the production libraries, no error reporting function is installed. You can either (1) use the return values of the functions and the value of VV_ERR to determine the type of runtime error that occurred or (2) write and install your own error reporting function.

Since errors detected by Vermont Views are generally fatal to the program, you can use the error reporting function to detect the errors and report them to the user before aborting the program. The error function can, in many instances, substitute for in-line code to handle error returns from functions. Using an error reporting function thus reduces the code needed to handle similar errors encountered during normal runtime operation of a program.


Home Contents Previous Next