bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Maxim Cournoyer
Subject: bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.
Date: Fri, 19 Jun 2020 17:33:02 -0400

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:

--8<---------------cut here---------------start------------->8---
(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
--8<---------------cut here---------------end--------------->8---

It seems our native -> srfi-34 style exception converter should populate
the message field with a formatted message, given that's what happens to
present errors as explained in libguile/error.c:

    When an error is reported,\n
    "these are replaced by formatting the corresponding members of\n"
    "@var{args}: @code{~A} (was @code{%s} in older versions of\n"
    "Guile) formats using @code{display} and @code{~S}

I'm not sure about the second ~S that appeared in the Guix output;
possibly the exception got re-thrown and suffered from a slightly
different conversion problem?

Anyway, the simple patch attached should fix the "~A" exception message.

Thank you,

Maxim

Attachment: 0001-ice-9-exceptions-Properly-format-the-error-message.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]