Next: Error Symbols—Condition Names, Previous: Using condition-case to Trap and Handle Errors with Handlers, Up: Errors—Unintentional Nonlocal Exits [Index]
ignore-errors macro
ignore-error macro
with-demoted-errors macro
This construct executes ‘BODY’, ignoring any errors that occur during its
execution. If the execution is without error, ignore-errors returns the
value of the last form in body; otherwise, it returns ‘nil’.
Here’s the example at the beginning of this subsection rewritten using
ignore-errors:
(ignore-errors (delete-file filename))
This macro is like ignore-errors, but will only ignore the specific error
condition specified. ‘CONDITION’ can also be a list of error conditions.
(ignore-error end-of-file
(read ""))
This macro is like a milder version of ignore-errors. Rather than
suppressing errors altogether, it converts them into messages. It uses the
string ‘FORMAT’ to format the message. ‘FORMAT’ should contain a single
‘%’-sequence; e.g., "Error: %S". Use with-demoted-errors around code that
is not expected to signal errors, but should be robust if one does occur.
Note that this macro uses condition-case-unless-debug rather than
condition-case.