unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Vivien Kraus via General Guile related discussions <guile-user@gnu.org>
To: guile-user@gnu.org
Subject: Exception handler installed when handling a continuable exception
Date: Mon, 09 Aug 2021 09:26:38 +0200	[thread overview]
Message-ID: <877dgv2i4x.fsf@planete-kraus.eu> (raw)


Dear guile users,

When an exception is raised with #:continuable?, and when the handler
returns a value, then the program continues.

This is why this program prints "hello":

(use-modules (ice-9 exceptions))

(with-exception-handler
    (lambda (exn)
      ;; We want to return "hello"
      "hello\n")
  (lambda ()
    (format (current-error-port)
            (raise-exception (make-exception-with-message "What should I say?")
                             #:continuable? #t))))

Now, in the handler, I may want to handle other kinds of exceptions:

(use-modules (ice-9 exceptions))

(with-exception-handler
    (lambda (exn)
      ;; We want to return "hello"
      (false-if-exception
       ;; Shouldn’t this error be ignored?
       (error "messing around"))
      "hello\n")
  (lambda ()
    (format (current-error-port)
            (raise-exception (make-exception-with-message "What should I say?")
                             #:continuable? #t))))

Is this a bug?

Best regards,

Vivien



             reply	other threads:[~2021-08-09  7:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  7:26 Vivien Kraus via General Guile related discussions [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-08-25 19:08 Exception handler installed when handling a continuable exception Maxime Devos
2021-09-30 21:39 ` Vivien Kraus via General Guile related discussions

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=877dgv2i4x.fsf@planete-kraus.eu \
    --to=guile-user@gnu.org \
    --cc=vivien@planete-kraus.eu \
    /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).