Subject: bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 28 Jun 2020 00:25:28 -0400

Hello Bengt,

Bengt Richter <[email-masked]> writes:

[...]

> What do you think of using (ice-9 match) to make a universal throwage-formatter,
> with the idea of making readable top level code for how exceptions become messages on screen?
>
> I started a hack to explore the (throw 'whatever any ...) space, beginning like
>
> (use-modules (ice-9 match))
> (define (make-exception-message key rest)
>   (begin
>     (let*((l (cons key rest)))
>       (match l
> 	     (('system-error subr message args data ...)
> 	      ;; e.g. thrown with key 'system-error: ("open-fdes" "~A" ("No such file or directory") (2))
> 	      (format #f (string-append "match-1: subr ~s threw '~s " message " sterror: ~s") subr key args (strerror (car (car data)))))
>
> 	     (('signal   any ...)
>               ;; not yet implemented
> 	      (format #f "match-2: <NYI:unix signal no> any: ~s" any))

Are you proposing to refactor (ice-9 exceptions) so that it's simpler to
follow a condition message is formed for a given exception type?

Maxim