Subject: [clisp-list] How to handle errors automatically

From: sorokinru <[email-masked]>
Date: Wed Sep 3 01:10:20 2003

Hello clisp-list,

  I am a list newbi. I tried to handle errors with the UNWIND-PROTECT
  function, but CLISP stop execution and switch to break dialog. How
  to handle errors programmatically without execution breake? Thanks in advance.

-- 
Sincerely,
 Ru                          mailto:[email-masked]

---

From: Douglas Philips <[email-masked]>
Date: Wed Sep 3 04:26:04 2003

>   to handle errors programmatically without execution breake? Thanks 

UNWIND-PROTECT does not handle errors, it simply lets you run code as 
"your" stack is being exited. You probably want to use HANDLER-BIND or 
HANDLER-CASE, but without knowing more specificly what you're trying to 
do...

I've found (so far) that CLISP conforms to the ANSI spec for 
CATCH/THROW/SIGNAL/HANDLER...

<D\'gou

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Wed Sep 3 05:16:01 2003

>   to handle errors programmatically without execution breake? Thanks in advance.

For this, I use handler-case:

[2]> (handler-case
        (/ 1 0)
     (error (err) (format t "Got an error ~S~%" err) :infinity))
[9]> Got an error #<SYSTEM::SIMPLE-DIVISION-BY-ZERO #x203E66D1>
:INFINITY

-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.