ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   9 Conditions   9.2 Dictionary of Conditions

9.2.28 ignore-errors Macro

ignore-errors {form}*    {result}*

Arguments and Values:
forms - an implicit progn.

results - In the normal situation, the values of the forms are returned; in the exceptional situation, two values are returned: nil and the condition.

ignore-errors is used to prevent conditions of type error from causing entry into the debugger.

Specifically, ignore-errors executes forms in a dynamic environment where a handler for conditions of type error has been established; if invoked, it handles such conditions by returning two values, nil and the condition that was signaled, from the ignore-errors form.

If a normal return from the forms occurs, any values returned are returned by ignore-errors.

 (defun load-init-file (program)
   (let ((win nil))
     (ignore-errors ;if this fails, don't enter debugger
       (load (merge-pathnames (make-pathname :name program :type :lisp)
       (setq win t))
     (unless win (format t "~&Init file failed to load.~%"))
 (load-init-file "no-such-program")
 Init file failed to load.

See Also:
handler-case, Section 9.1 Condition System Concepts

 (ignore-errors . forms)

is equivalent to:

 (handler-case (progn . forms)
   (error (condition) (values nil condition)))

Because the second return value is a condition in the exceptional case, it is common (but not required) to arrange for the second return value in the normal case to be missing or nil so that the two situations can be distinguished.

Allegro CL Implementation Details:

Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2015 - File last updated 03-23-2015