From 642c934fb0cb1650ffd5b13127774d73c8a1af35 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Tue, 24 Dec 2024 18:16:41 +0300 Subject: [PATCH 1/2] Upon archive download failure print the original error (Bug#75065) * lisp/emacs-lisp/package.el (package--download-and-read-archives): upon catching exception, use the exception message as part of the error to provide more context about the failure. --- lisp/emacs-lisp/package.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 5f785071ea3..81f0ac0162f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1829,10 +1829,10 @@ Populate `package-archive-contents' with the result. 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) err))))) (defvar package-refresh-contents-hook (list #'package--download-and-read-archives) "List of functions to call to refresh the package archive. -- 2.47.1 From cf8f2ca0915743027160dc516eea4fd565b62ffa Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Thu, 26 Dec 2024 23:54:25 +0300 Subject: [PATCH 2/2] Upon keyring import fail print the full error (Bug#75065) As discussed at Bug#75065, the `(car error)' contains the exception type and it's better to print the full error content. * lisp/emacs-lisp/package.el (package-refresh-contents): upon keyring import failure print the full content. --- lisp/emacs-lisp/package.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 81f0ac0162f..e24db4567e1 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1856,7 +1856,7 @@ downloads in the background." (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))))) (run-hook-with-args 'package-refresh-contents-hook async)) -- 2.47.1