mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
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.
This commit is contained in:
parent
92d767bae2
commit
3c73d77e2a
2 changed files with 16 additions and 6 deletions
|
@ -1492,6 +1492,11 @@ exception composed of such an instance."
|
||||||
(proc (car exceptions))
|
(proc (car exceptions))
|
||||||
(lp (cdr 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
|
;; Define catch and with-throw-handler, using some common helper routines and a
|
||||||
|
|
|
@ -156,13 +156,18 @@
|
||||||
;; When a native guile exception is caught by with-exception-handler, we
|
;; When a native guile exception is caught by with-exception-handler, we
|
||||||
;; convert it to a compound exception that includes not only the
|
;; convert it to a compound exception that includes not only the
|
||||||
;; standard exception objects expected by users of R6RS, SRFI-35, and
|
;; standard exception objects expected by users of R6RS, SRFI-35, and
|
||||||
;; R7RS, but also a special &guile condition that preserves the original
|
;; R7RS, but also a special &exception-with-key-and-args condition that
|
||||||
;; KEY and ARGS passed to the native Guile catch handler.
|
;; preserves the original KEY and ARGS passed to the native Guile catch
|
||||||
|
;; handler.
|
||||||
|
|
||||||
(define-exception-type &guile &exception
|
(define make-guile-exception
|
||||||
make-guile-exception guile-exception?
|
(record-constructor &exception-with-key-and-args))
|
||||||
(key guile-exception-key)
|
(define guile-exception?
|
||||||
(args guile-exception-args))
|
(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)
|
(define (default-guile-exception-converter key args)
|
||||||
(make-exception (make-error)
|
(make-exception (make-error)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue