* excpetion printing
@ 2021-04-21 0:43 Matt Wette
2021-04-21 1:18 ` Matt Wette
2021-05-04 20:21 ` Ludovic Courtès
0 siblings, 2 replies; 3+ messages in thread
From: Matt Wette @ 2021-04-21 0:43 UTC (permalink / raw)
To: Guile User
Is there any error I can throw in Guile that I don't catch myself
but will result in a user-friendly error message at the top? Not this:
Throw to key `misc' with args `("read-yaml-file" "file not found: ~S"
("demo1x.yml") #f)'.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: excpetion printing
2021-04-21 0:43 excpetion printing Matt Wette
@ 2021-04-21 1:18 ` Matt Wette
2021-05-04 20:21 ` Ludovic Courtès
1 sibling, 0 replies; 3+ messages in thread
From: Matt Wette @ 2021-04-21 1:18 UTC (permalink / raw)
To: guile-user
On 4/20/21 5:43 PM, Matt Wette wrote:
> Is there any error I can throw in Guile that I don't catch myself
> but will result in a user-friendly error message at the top? Not this:
>
> Throw to key `misc' with args `("read-yaml-file" "file not found: ~S"
> ("demo1x.yml") #f)'.
>
>
I did get this:
yaml.scm:37:4: In procedure read-yaml-file:
ERROR:
1. &message: "read-yaml-file: can't access file:demo1x.yml
using guile 3.0 from
(cond-expand
(guile-3
(use-modules (ice-9 exceptions))
(define (file-not-found filename)
(raise-exception
(make-exception-with-message
(string-append "read-yaml-file: can't access file:"
filename)))))
(else
(define (file-not-found filename)
(scm-error 'misc "read-yaml-file"
"file not found: ~S" (list filename) #f))))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: excpetion printing
2021-04-21 0:43 excpetion printing Matt Wette
2021-04-21 1:18 ` Matt Wette
@ 2021-05-04 20:21 ` Ludovic Courtès
1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2021-05-04 20:21 UTC (permalink / raw)
To: guile-user
Hi Matt,
Matt Wette <matt.wette@gmail.com> skribis:
> Is there any error I can throw in Guile that I don't catch myself
> but will result in a user-friendly error message at the top? Not this:
>
> Throw to key `misc' with args `("read-yaml-file" "file not found: ~S"
> ("demo1x.yml") #f)'.
You can call ‘print-exception’ like so:
(print-exception (current-error-port) frame key args)
This is using the pre-3.0 key+args exception style.
HTH,
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-04 20:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 0:43 excpetion printing Matt Wette
2021-04-21 1:18 ` Matt Wette
2021-05-04 20:21 ` Ludovic Courtès
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).