See the chapter of CLtL2 on the Condition System. You can establish a
handler for ARITHMETIC-ERROR, DIVIDE-BY-ZERO, FLOATING-POINT-OVERFLOW,
and/or FLOATING-POINT-UNDERFLOW.
Or if you just want the expression to return NIL if it gets an error, use
the IGNORE-ERRORS macro.
--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.
if the expression is truly uninteresting when it contains such an error,
you can wrap the call to `eval' in an `ignore-errors' form. the primary
value is then nil if an error occurred. you may check the secondary value
for any condition that might have occurred. otherwise, you might want to
consider setting up a handler for the condition `arithmetic-error'. you
also gain access to the operands and the operation that caused this
condition.
(handler-case (+ (/ 3 4) (/ 1 0))
(arithmetic-error (x)
(format t "~S bit the proverbial bullet"
(cons (arithmetic-error-operation x)
(arithmetic-error-operands x)))))
-| (/ 1 0) bit the proverbial bullet
=> nil
#\Erik
--
if you think this year is "97", _you_ are not "year 2000 compliant".
see http://www.naggum.no/emacs/ for Emacs-20-related material.