unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Konstantin Kharlamov <Hi-Angel@yandex.ru>
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: Thu, 26 Dec 2024 15:40:21 -0500	[thread overview]
Message-ID: <jwvv7v6rxni.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <ad86a663e1c4c033c8bfd8c46eb7cf79fd98ab08.camel@yandex.ru> (Konstantin Kharlamov's message of "Thu, 26 Dec 2024 23:14:10 +0300")

> 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`, ...

>> > It seems harmless, I am just uncertain if we should prefer %S or %s
>> > to format the error message.
>>
>> `%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.
>
> In my tests there seems to be no difference in the output between %s
> and %S.

Try (format "%S" '(a "b")) vs (format "%s" '(a "b"))

> I would presume doing `(message "%s" '(a b))` would result in
> error as the param isn't a string, but it works.

I agree that in an ideal world it should signal an error, but here
we are.


        Stefan






  parent reply	other threads:[~2024-12-26 20:40 UTC|newest]

Thread overview: 16+ 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 [this message]
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
2024-12-27 18:34         ` Konstantin Kharlamov

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/emacs/

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

  git send-email \
    --in-reply-to=jwvv7v6rxni.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=75065@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).