From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 75065@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>,
Eli Zaretskii <eliz@gnu.org>
Subject: bug#75065: Upon archive download failure print the original error
Date: Fri, 27 Dec 2024 00:03:59 +0300 [thread overview]
Message-ID: <f7caf726f82fa48980cab78cd5034ae9cfb484ea.camel@yandex.ru> (raw)
In-Reply-To: <fd4229010c582ee00c9cb318502fbd1169866b26.camel@yandex.ru>
[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]
On Thu, 2024-12-26 at 23:53 +0300, Konstantin Kharlamov wrote:
> Oh, actually, let me fix the other place as well then…
>
> On Thu, 2024-12-26 at 23:51 +0300, Konstantin Kharlamov wrote:
> > On Thu, 2024-12-26 at 15:40 -0500, Stefan Monnier wrote:
> > > > The `car` seems to just contain word error. Here's how both
> > > > compare:
> > > >
> > > > • current patch with `(cdr err)`:
> > > > Failed to download ‘melpa’ archive. Error: ("Location
> > > > melpa.org/packages/ is not a url nor an absolute file name")
> > > >
> > > > • suggested change with `err`:
> > > > Failed to download ‘melpa’ archive. Error: (error "Location
> > > > melpa.org/packages/ is not a url nor an absolute file name")
> > > >
> > > > I can of course remove the word `Error` in the second case.
> > > > My question then is: will `(car err)` always be the word
> > > > "error"?
> > > > Or
> > > > may there be another content?
> > >
> > > The shape and content of `err` depends on the actual error that
> > > caused
> > > the download to fail. `(car err)` contains the error "type",
> > > which
> > > can
> > > be `error` but can also be more specific such as
> > > `wrong-number-of-arguments`, `file-error`, ...
> >
> > Thank you, I see!
> >
> > Please check the attached patch. With this change the error of
> > accessing https-less address is shown as follows:
> >
> > Failed to download ‘melpa’ archive: (error "Location
> > melpa.org/packages/ is not a url nor an absolute file name")
>
Done, please review 😊
[-- Attachment #2: 1.patch --]
[-- Type: text/x-patch, Size: 2574 bytes --]
From 642c934fb0cb1650ffd5b13127774d73c8a1af35 Mon Sep 17 00:00:00 2001
From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
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 <Hi-Angel@yandex.ru>
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))
\f
--
2.47.1
next prev parent reply other threads:[~2024-12-26 21:03 UTC|newest]
Thread overview: 15+ 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 [this message]
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
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=f7caf726f82fa48980cab78cd5034ae9cfb484ea.camel@yandex.ru \
--to=hi-angel@yandex.ru \
--cc=75065@debbugs.gnu.org \
--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.