Next: , Previous: , Up: Errors   [Contents][Index]


15.5.3.2 How SXEmacs Processes Errors

When an error is signaled, signal searches for an active handler for the error. A handler is a sequence of Lisp expressions designated to be executed if an error happens in part of the Lisp program. If the error has an applicable handler, the handler is executed, and control resumes following the handler.

The handler executes in the environment of the condition-case that established it; all functions called within that condition-case have already been exited, and the handler cannot return to them.

If there is no applicable handler for the error, the current command is terminated and control returns to the editor command loop, because the command loop has an implicit handler for all kinds of errors. The command loop’s handler uses the error symbol and associated data to print an error message.

Errors in command loop are processed using the command-error function, which takes care of some necessary cleanup, and prints a formatted error message to the echo area. The functions that do the formatting are explained below.

Function: display-error error-object stream

This function displays error-object on stream. error-object is a cons of error type, a symbol, and error arguments, a list. If the error type symbol of one of its error condition superclasses has a display-error property, that function is invoked for printing the actual error message. Otherwise, the error is printed as ‘Error: arg1, arg2, ...’.

Function: error-message-string error-object

This function converts error-object to an error message string, and returns it. The message is equivalent to the one that would be printed by display-error, except that it is conveniently returned in string form.

An error that has no explicit handler may call the Lisp debugger. The debugger is enabled if the variable debug-on-error (see Error Debugging) is non-nil. Unlike error handlers, the debugger runs in the environment of the error, so that you can examine values of variables precisely as they were at the time of the error.


Next: , Previous: , Up: Errors   [Contents][Index]