The error system interface is minimal. There is a simple editor-error condition which is a subtype of error and a convenient means for signaling them. Hemlock also provides a standard handler for error conditions while in the editor.
Handlers for editor-error conditions can access the condition object with these.
&rest
args ¶This function is called to signal minor errors within Hemlock; these are errors
that a normal user could encounter in the course of editing such as a search
failing or an attempt to delete past the end of the buffer. This function
signal
’s an editor-error condition formed from args, which are nil or
a format
string possibly followed by format
arguments. Hemlock
invokes commands in a dynamic context with an editor-error condition handler
bound. This default handler beeps or flashes (or both) the display. If the
condition passed to the handler has a non-nil string slot, the handler also
invokes message
on it. The command in progress is always aborted, and this
function never returns.
Within the body of this macro any Lisp errors that occur are handled in some
fashion more gracefully than simply dumping the user in the debugger. This
macro should be wrapped around code which may get an error due to some action
of the user — for example, evaluating code fragments on the behalf of and
supplied by the user. Using this in a command allows the established handler
to shadow the default editor-error handler, so commands should take care to
signal user errors (calls to editor-errors
) outside of this context.