Innehållsförteckning RecentChanges News ElispArea HowTo Problems Suggestions

DefiningErrors

Skillnad (från version 3 till rådande version)

Sammanfattning: Rollback to 2008-09-05 00:16 UTC

Information om ändring är inte tillgänglig.

For some bizarre reason, you have to create errors by hand, when it’s easy enough to define a deferror like this:

 (defmacro deferror (new-error parent message)
   "Defines NEW-ERROR as an error of type PARENT with MESSAGE."
   `(prog1
        ',new-error
      (put ',new-error 'error-conditions
           (cons ',new-error ',(get parent 'error-conditions)))
      (put ',new-error 'error-message ,message)))
 (put 'deferror 'lisp-indent-function 'defun)

Use like this:

 (deferror foo error
   "Foo!")