[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 05/07: Move exceptions with key and args to core
From: |
Andy Wingo |
Subject: |
[Guile-commits] 05/07: Move exceptions with key and args to core |
Date: |
Fri, 8 Nov 2019 09:31:57 -0500 (EST) |
wingo pushed a commit to branch wip-exceptions
in repository guile.
commit 3c73d77e2a5865b4b006e7363791dae7617cb5ac
Author: Andy Wingo <address@hidden>
Date: Thu Nov 7 16:43:23 2019 +0100
Move exceptions with key and args to core
* module/ice-9/boot-9.scm (&exception-with-key-and-args)
(&quit-exception): New definitions.
* module/ice-9/exceptions.scm (make-guile-exception):
(guile-exception?, guile-exception-key, guile-exception-args): Update
definitions.
---
module/ice-9/boot-9.scm | 5 +++++
module/ice-9/exceptions.scm | 19 ++++++++++++-------
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index f725686..7f7ad93 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -1492,6 +1492,11 @@ exception composed of such an instance."
(proc (car exceptions))
(lp (cdr exceptions))))))))))
+(define &exception-with-key-and-args
+ (make-exception-type '&exception-with-key-and-args &exception '(key args)))
+(define &quit-exception
+ (make-exception-type '&quit-exception &exception '(code)))
+
;; Define catch and with-throw-handler, using some common helper routines and a
diff --git a/module/ice-9/exceptions.scm b/module/ice-9/exceptions.scm
index 721140c..d3f63c2 100644
--- a/module/ice-9/exceptions.scm
+++ b/module/ice-9/exceptions.scm
@@ -156,13 +156,18 @@
;; When a native guile exception is caught by with-exception-handler, we
;; convert it to a compound exception that includes not only the
;; standard exception objects expected by users of R6RS, SRFI-35, and
-;; R7RS, but also a special &guile condition that preserves the original
-;; KEY and ARGS passed to the native Guile catch handler.
-
-(define-exception-type &guile &exception
- make-guile-exception guile-exception?
- (key guile-exception-key)
- (args guile-exception-args))
+;; R7RS, but also a special &exception-with-key-and-args condition that
+;; preserves the original KEY and ARGS passed to the native Guile catch
+;; handler.
+
+(define make-guile-exception
+ (record-constructor &exception-with-key-and-args))
+(define guile-exception?
+ (record-predicate &exception-with-key-and-args))
+(define guile-exception-key
+ (record-accessor &exception-with-key-and-args 'key))
+(define guile-exception-args
+ (record-accessor &exception-with-key-and-args 'args))
(define (default-guile-exception-converter key args)
(make-exception (make-error)
- [Guile-commits] branch wip-exceptions updated (b3b359d -> b31c94d), Andy Wingo, 2019/11/08
- [Guile-commits] 02/07: Move false-if-exception down in boot-9, Andy Wingo, 2019/11/08
- [Guile-commits] 05/07: Move exceptions with key and args to core,
Andy Wingo <=
- [Guile-commits] 01/07: Move adapter between "throw" and "raise" exceptions into core, Andy Wingo, 2019/11/08
- [Guile-commits] 04/07: Move the core of exception objects into core, Andy Wingo, 2019/11/08
- [Guile-commits] 03/07: Move exception-handling routines after records in boot-9, Andy Wingo, 2019/11/08
- [Guile-commits] 07/07: rebase throw/catch on top of raise-exception/with-exception-handler, Andy Wingo, 2019/11/08
- [Guile-commits] 06/07: Remove boot "catch" definition., Andy Wingo, 2019/11/08