[Top][All Lists]

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

I can't seem to get throw/catch to work

From: Tim Brown
Subject: I can't seem to get throw/catch to work
Date: Wed, 30 Jul 2003 12:18:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030723

I'm just starting to get up and running with guile (and scheme).

I'm trying to write a C extension which (eventually) will throw an
exception/error back to guile. I cannot catch an error generated with
scm_throw(). More importantly I can't seem to throw and error within
guile and catch it myself.

guile> (catch #t (throw 'foo) (lambda (key . args) (display key) (newline)))
<unnamed port>:1:11: In procedure gsubr-apply in expression (throw (quote foo)):
<unnamed port>:1:11: unhandled-exception: foo
ABORT: (misc-error)

Type "(backtrace)" to get more information or "(debug)" to enter the debugger.

Ok, so that's me throwing my own error to myself. But I can't even catch
an exception generated by guile.

Neither generally, using the (catch #t ...) nor specifically, using
(catch 'numerical-overflow ...):

guile> (catch #t (/ 1 0) (lambda (key . args) (display key) (newline)))
<unnamed port>:2:11: In procedure / in expression (/ 1 0):
<unnamed port>:2:11: Numerical overflow
ABORT: (numerical-overflow)
guile> (catch 'numerical-overflow (/ 1 0) (lambda (key . args) (display key) (newline)))
<unnamed port>:3:28: In procedure / in expression (/ 1 0):
<unnamed port>:3:28: Numerical overflow
ABORT: (numerical-overflow)
guile> (version)

This happens on linux, solaris and hpux builds, so I assume there's a
problem with my use of the language rather than anything else.

What am I missing here?


Tim Brown <address@hidden> |            City Computing Limited |
T: +44 20 8770 2110               |      City House, Sutton Park Road |
F: +44 20 8770 2130               |       Sutton, Surrey, SM1 2AE, GB |
BEAUTY: What's in your eye when you have a bee in your hand.__________/

reply via email to

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