unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Tim Brown <tim.brown@cityc.co.uk>
Subject: I can't seem to get throw/catch to work
Date: Wed, 30 Jul 2003 12:18:54 +0100	[thread overview]
Message-ID: <3F27A99E.8070903@cityc.co.uk> (raw)

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.
guile>

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)
"1.6.4"

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

-- 
Tim Brown <tim.brown@cityc.co.uk> |            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.__________/





_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


             reply	other threads:[~2003-07-30 11:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-30 11:18 Tim Brown [this message]
2003-07-30 14:45 ` I can't seem to get throw/catch to work Peter S. Christopher
  -- strict thread matches above, loose matches on Subject: below --
2003-07-30 14:22  Dirk Eßer 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F27A99E.8070903@cityc.co.uk \
    --to=tim.brown@cityc.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).