From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Philip Kaludercic <philipk@posteo.net>
Cc: 75065-done@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
Konstantin Kharlamov <Hi-Angel@yandex.ru>
Subject: bug#75065: Upon archive download failure print the original error
Date: Fri, 27 Dec 2024 12:01:14 -0500 [thread overview]
Message-ID: <jwvseq96p0c.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwv7c7mtg2x.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 26 Dec 2024 14:17:46 -0500")
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
> `%s` to print `err` or `(cdr err)` would be wrong, since `%s` is for use
> with strings rather than lists. IOW, IMO, it should be either
>
> ...%S" ... err)
>
> or
>
> ...%s" ... (error-message-string err))
>
> where the first is a bit more "debugging/developer" friendly and the second
> is a bit more "user" friendly.
Revising the code of `package.el` I see that those errors&messages are
meant to be exposed to the user, so they should preferably use
`error-message-string`.
So I installed the patch below into `master`.
Thank you!
Closing,
Stefan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: package.patch --]
[-- Type: text/x-diff, Size: 2378 bytes --]
commit a99e1cc745047977b0b7cbd25fe9df66e9c86a39
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Fri Dec 27 11:58:30 2024 -0500
(package--download-and-read-archives): Fix bug#75065
* lisp/emacs-lisp/package.el (package--download-and-read-archives):
Include the error info in the error message.
Suggested by Konstantin Kharlamov <Hi-Angel@yandex.ru>.
(package-refresh-contents, package-menu--perform-transaction):
Use `error-message-string`.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 5f785071ea3..bff45d57b07 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1829,10 +1829,11 @@ package--download-and-read-archives
If optional argument ASYNC is non-nil, perform the downloads
asynchronously."
(dolist (archive package-archives)
- (condition-case-unless-debug nil
+ (condition-case-unless-debug err
(package--download-one-archive archive "archive-contents" async)
- (error (message "Failed to download `%s' archive."
- (car archive))))))
+ (error (message "Failed to download `%s' archive: %s"
+ (car archive)
+ (error-message-string err))))))
(defvar package-refresh-contents-hook (list #'package--download-and-read-archives)
"List of functions to call to refresh the package archive.
@@ -1856,7 +1857,8 @@ package-refresh-contents
(when (and (package-check-signature) (file-exists-p default-keyring))
(condition-case-unless-debug error
(package-import-keyring default-keyring)
- (error (message "Cannot import default keyring: %S" (cdr error))))))
+ (error (message "Cannot import default keyring: %s"
+ (error-message-string error))))))
(run-hook-with-args 'package-refresh-contents-hook async))
\f
@@ -3989,8 +3991,9 @@ package-menu--perform-transaction
(package-delete elt nil 'nosave))
(error
(push (package-desc-full-name elt) errors)
- (message "Error trying to delete `%s': %S"
- (package-desc-full-name elt) err)))))
+ (message "Error trying to delete `%s': %s"
+ (package-desc-full-name elt)
+ (error-message-string err))))))
errors))
(defun package--update-selected-packages (add remove)
next prev parent reply other threads:[~2024-12-27 17:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-24 15:25 bug#75065: Upon archive download failure print the original error Konstantin Kharlamov
2024-12-26 8:55 ` Eli Zaretskii
2024-12-26 18:13 ` Philip Kaludercic
2024-12-26 18:17 ` Konstantin Kharlamov
2024-12-26 18:31 ` Philip Kaludercic
2024-12-26 19:17 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-26 20:14 ` Konstantin Kharlamov
2024-12-26 20:32 ` Stefan Kangas
2024-12-26 20:37 ` Konstantin Kharlamov
2024-12-26 20:40 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-26 20:51 ` Konstantin Kharlamov
2024-12-26 20:53 ` Konstantin Kharlamov
2024-12-26 21:03 ` Konstantin Kharlamov
2024-12-27 7:22 ` Eli Zaretskii
2024-12-27 17:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-27 18:34 ` Konstantin Kharlamov
2024-12-28 3:09 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvseq96p0c.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=75065-done@debbugs.gnu.org \
--cc=Hi-Angel@yandex.ru \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=philipk@posteo.net \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.