unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* 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

unofficial mirror of guile-user@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-user/0 guile-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-user guile-user/ https://yhetil.org/guile-user \
		guile-user@gnu.org
	public-inbox-index guile-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.user
	nntp://news.gmane.io/gmane.lisp.guile.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git