gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] ignore-errors


From: Steve Eichblatt
Subject: [Gcl-devel] ignore-errors
Date: Sat, 20 Mar 2004 20:55:01 -0600

Hi,

I am new to lisp. Please let me know if this is the wrong forum for this
type of question.

I am looking for a way to trap (and possibly ignore) error messages
generated within a function call. Something like in Python:

try:  
  something
except:
  pass

I have read about a function ignore-errors, but it's not defined by
default in gcl. 

I found a way to call it, using:

(load "/usr/local/gcl-2.5.2/clcs/loading.lisp")
(load "/usr/local/gcl-2.5.2/clcs/package.lisp")
(load "/usr/local/gcl-2.5.2/clcs/clcs_handler.lisp")

which defines the macro ignore-errors (i don't know how to make this
less implementation-dependent)

However, it doesn't work like i was expecting.

>(conditions:ignore-errors (oddp 1))
 
T
 
>(conditions:ignore-errors (oddp 0))
 
NIL

>(conditions:ignore-errors (oddp '(1 2)))
 
Error: (1 2) is not of type INTEGER.
Fast links are on: do (si::use-fast-links nil) for debugging
Error signalled by ODDP.
Broken at ODDP.  Type :H for Help.

I was expecting the last call to return NIL, based on my interpretation
of Steele's book:

"If no ... condition is signaled, any values returned by the last form
are returned by ignore-errors. Otherwise, two values are returned: nil
and the error condition that was signaled."

Thanks in advance,

-- 
Steve Eichblatt
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]