[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.
From: |
Maxim Cournoyer |
Subject: |
bug#41956: [PATCH] ice-9: exceptions: Properly format the error message. |
Date: |
Sun, 28 Jun 2020 00:17:04 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hello Ricardo!
Ricardo Wurmus <rekado@elephly.net> writes:
> Hi Maxim,
>
> here’s what I did in the REPL:
>
> scheme@(guile-user)> ,m (ice-9 exceptions)
> scheme@(ice-9 exceptions)> (define (my/guile-system-error-converter key args)
> (apply (case-lambda
> ((subr msg-args msg errno . rest)
> ;; XXX TODO we should return a more specific error
> ;; (usually an I/O error) as expected by R6RS programs.
> ;; Unfortunately this often requires the 'filename' (or
> ;; other?) which is not currently provided by the native
> ;; Guile exceptions.
> (make-exception
> (make-external-error)
> (make-exception-with-origin subr)
> (apply make-exception-with-message msg)
> (make-exception-with-irritants msg-args)))
> (_ (guile-external-error-converter key args)))
> args))
> scheme@(ice-9 exceptions)> (set! guile-exception-converters (acons
> 'system-error my/guile-system-error-converter guile-exception-converters))
> scheme@(ice-9 exceptions)> ,m (guile-user)
> scheme@(guile-user)> (guard (c ((message-condition? c)
> (format #t "message: ~a~%" (condition-message c))))
> (canonicalize-path "/doesntexist"))
> message: No such file or directory
> $11 = #t
> scheme@(guile-user)>
I've tested that this indeed works, although I don't quite understand
how?
This brings embeds the definition of `guile-common-exceptions' into
`guile-system-error-converter', with a single change:
(make-exception-with-message msg) --> (apply make-exception-with-message
msg msg-args)
What is the magic I fail to see?
Is this fix proper to be merged into the original
guile-common-exceptions procedure?
Thank you!
Maxim
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Maxim Cournoyer, 2020/06/19
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., maxim . cournoyer, 2020/06/20
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Bengt Richter, 2020/06/20
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Maxim Cournoyer, 2020/06/20
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Ricardo Wurmus, 2020/06/25
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Bengt Richter, 2020/06/25
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Maxim Cournoyer, 2020/06/28
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Bengt Richter, 2020/06/28
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.,
Maxim Cournoyer <=
- bug#41956: [PATCH] ice-9: exceptions: Properly format the error message., Ricardo Wurmus, 2020/06/28