unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: maxim.cournoyer@gmail.com
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 41956@debbugs.gnu.org
Subject: bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.
Date: Sat, 20 Jun 2020 01:46:13 -0400	[thread overview]
Message-ID: <87wo42mgre.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87eeqad9m9.fsf@gmail.com> (Maxim Cournoyer's message of "Fri, 19 Jun 2020 17:33:02 -0400")

Maxim Cournoyer <maxim.cournoyer@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





  reply	other threads:[~2020-06-20  5:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 21:33 bug#41956: [PATCH] ice-9: exceptions: Properly format the error message Maxim Cournoyer
2020-06-20  5:46 ` maxim.cournoyer [this message]
2020-06-20 18:33   ` Bengt Richter
2020-06-21  3:49     ` Maxim Cournoyer
2020-06-25 10:04       ` Ricardo Wurmus
2020-06-25 16:33         ` Bengt Richter
2020-06-28  4:25           ` Maxim Cournoyer
2020-06-28 18:23             ` Bengt Richter
2020-06-28  4:17         ` Maxim Cournoyer
2020-06-28  4:31           ` Ricardo Wurmus
2021-06-02  7:32 ` bug#41956: is this still current ? Adriano Peluso
2023-11-10  4:17   ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wo42mgre.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me \
    --to=maxim.cournoyer@gmail.com \
    --cc=41956@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).