Re: Returning to top-level on error
- From: "Joe Marshall" <eval.apply@xxxxxxxxx>
- Date: 30 Dec 2005 22:50:09 -0800
Steven M. Haflich wrote:
> Pascal Bourguignon wrote:
>
> >>Can Lisp be told not to enter the "break loop" when encountering an
> >>error, but instead just return to the top-level?
> >
> > (ignore-errors (do-something))
>
> This is appropriate for almost any normal circumstance, but isn't
> quite bulletproof.
It ignores too much on Allegro Common Lisp, which seems to consider
control-C to be an error.
(defmacro ignore-errors (&rest forms)
(let ((block-name (gensym "IGNORE-ERRORS-BLOCK-")))
`(BLOCK ,block-name
(HANDLER-BIND (#+allegro (EXCL:INTERRUPT-SIGNAL #'ERROR)
(ERROR (LAMBDA (CONDITION)
(RETURN-FROM ,block-name
(values NIL CONDITION)))))
,@forms))))
.
- References:
- Returning to top-level on error
- From: Nicholas Sandow
- Re: Returning to top-level on error
- From: Pascal Bourguignon
- Re: Returning to top-level on error
- From: Steven M. Haflich
- Returning to top-level on error
- Prev by Date: Re: Returning to top-level on error
- Next by Date: Re: Returning to top-level on error
- Previous by thread: Re: Returning to top-level on error
- Next by thread: Re: Returning to top-level on error
- Index(es):