[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
*error-handler*
- To: clisp-list@ma2s2.mathematik.uni-karlsruhe.de
- Subject: *error-handler*
- From: Calvin Clark <ckclark@MIT.EDU>
- Date: Sun, 28 Nov 93 01:08:34 -0500
The variable *error-handler* is not documented in impnotes.txt. Is it
likely to be preserved in future versions of CLISP? I would like to be
able to use it in macros like this:
(defmacro with-handled-error (&body body)
(let ((blockvar (gensym)))
`(block ,blockvar
(let ((*error-handler*
#'(lambda (arg1 &rest args)
(apply 'format (cons *error-output* args))
(return-from ,blockvar nil))))
,@body))))
The macro works like this:
> (with-handled-error (pathname "~nouser"))
UNIX error 2 (ENOENT): No such file or directory
NIL
> (with-handled-error (open "/dev/rrz0a" :direction :input))
UNIX error 13 (EACCES): Permission denied
NIL
>
What are the potential caveats in using *error-handler* this way?
Are there better ways in CLISP to deal with system errors in code?
-Calvin