733 |
@subsubsection How to Signal an Error |
@subsubsection How to Signal an Error |
734 |
@cindex signaling errors |
@cindex signaling errors |
735 |
|
|
736 |
|
@dfn{Signalling} an error means beginning error processing. Error |
737 |
|
processing normally aborts all or part of the running program and |
738 |
|
returns to a point that is set up to handle the error |
739 |
|
(@pxref{Processing of Errors}). Here we describe how to signal an |
740 |
|
error. |
741 |
|
|
742 |
Most errors are signaled ``automatically'' within Lisp primitives |
Most errors are signaled ``automatically'' within Lisp primitives |
743 |
which you call for other purposes, such as if you try to take the |
which you call for other purposes, such as if you try to take the |
744 |
@sc{car} of an integer or move forward a character at the end of the |
@sc{car} of an integer or move forward a character at the end of the |
749 |
considered an error, but it is handled almost like an error. |
considered an error, but it is handled almost like an error. |
750 |
@xref{Quitting}. |
@xref{Quitting}. |
751 |
|
|
752 |
The error message should state what is wrong (``File does not |
Every error specifies an error message, one way or another. The |
753 |
exist''), not how things ought to be (``File must exist''). The |
message should state what is wrong (``File does not exist''), not how |
754 |
convention in Emacs Lisp is that error messages should start with a |
things ought to be (``File must exist''). The convention in Emacs |
755 |
capital letter, but should not end with any sort of punctuation. |
Lisp is that error messages should start with a capital letter, but |
756 |
|
should not end with any sort of punctuation. |
757 |
|
|
758 |
@defun error format-string &rest args |
@defun error format-string &rest args |
759 |
This function signals an error with an error message constructed by |
This function signals an error with an error message constructed by |