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

Previous Next

Package: guile;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Fri, 19 Jun 2020 21:34:01 UTC

Severity: normal

Tags: patch

Full log


Message #8 received at 41956 <at> debbugs.gnu.org (full text, mbox):

From: maxim.cournoyer <at> gmail.com
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 41956 <at> debbugs.gnu.org
Subject: Re: bug#41956: [PATCH] ice-9: exceptions: Properly format the error
 message.
Date: Sat, 20 Jun 2020 01:46:13 -0400
Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> Hello,
>
> I had this problem in Guix where 'guix deploy my-config.scm' would
> unhelpfully report an error like:
>
> guix deploy: error: failed to deploy my-host: ~A: ~S
>
> Digging a bit, I could reproduce at the REPL with:
>
> (guard (c ((message-condition? c)
>            (format #t "error: ~a~%" (condition-message c))))
>   ;; This is what (canonicalize-path "/do/not/exist) ends up doing:
>   (throw 'system-error "canonicalize-path" "~A" '("No such file or directory")))
>
> --> error: ~A

[...]

Unfortunately the previous patch breaks the tests, with errors like:

ERROR: bytevectors.test: Datum Syntax: incorrect prefix - arguments: ((wrong-type-arg "apply" "Apply to non-list: ~S" (#\i) (#\i)))

I'm out of ideas for now, I last tried:

--8<---------------cut here---------------start------------->8---
modified   module/ice-9/exceptions.scm
@@ -189,7 +189,10 @@
           ((subr msg margs . _)
            (make-exception
             (make-exception-with-origin subr)
-            (make-exception-with-message msg)
+            (let ((msg (if (null? margs)
+                           msg
+                           (apply simple-format #f msg margs))))
+                (make-exception-with-message msg))
             (make-exception-with-irritants margs)))
           (_ (make-exception-with-irritants args)))
          args))
--8<---------------cut here---------------end--------------->8---

To the same effect.

Maxim




This bug report was last modified 1 year and 305 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.