next up previous contents
Next: Customizing The Default Handlers Up: GRASP Error Handling Previous: Reporting Errors In GRASP   Contents

How GRASP Error Reports Are Handled

Programs vary widely in how they notify the user of errors. A simple command-line program will probably print the messages to the screen or a file, while a program with a graphical interface will likely send them to an error log window or to a dialog window. GRASP allows arbitrary error handlers to be specified, but the default provided will probably suffice for most GRASP application programmers.

Calling GR_set_errors_enabled() with an argument of false (zero) will suppress all GRASP error messages regardless of the actual handlers used, while a true argument will enable them again. GR_errors_enabled() returns true if errors are currently enabled and false otherwise. Errors always start out enabled unless the environment variable 'GRASP_NODEBUG' exists (its value is irrelevant), in which case they are disabled by default. Errors may be disabled within a handler, but the change will not take place until the next GR_start_error() call.

By default, the default error handlers print errors to stderr. The function, file, and line number are reported in a standard header format, followed by the message itself printed as though each call to GR_report_error(format, args) was a call to fprintf(stderr, format, args), and ending with the RCS ID of the file containing the function source. If the environment variable 'GRASP_ERRORFILE' exists and its value is the pathname of a file which can be opened for appending that filename is used instead of stderr. Finally, if in addition 'GRASP_ERRORFILE_OVERWRITE' exists (its value is irrelevant) the file is overwritten rather than appended to.


next up previous contents
Next: Customizing The Default Handlers Up: GRASP Error Handling Previous: Reporting Errors In GRASP   Contents
Bruce Allen 2000-11-19