GNU bug report logs - #25735
26.0.50; url-retrieve errors are peculiar

Previous Next

Package: emacs;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Tue, 14 Feb 2017 21:23:01 UTC

Severity: minor

Tags: fixed

Found in version 26.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 25735 <at> debbugs.gnu.org (full text, mbox):

From: Richard Copley <rcopley <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 25735 <at> debbugs.gnu.org
Subject: Re: bug#25735: 26.0.50; url-retrieve errors are peculiar
Date: Wed, 15 May 2019 08:01:55 +0100
[Message part 1 (text/plain, inline)]
On Wed, 15 May 2019 at 07:04, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Richard Copley <rcopley <at> gmail.com> writes:
>
> > Within the docstring for url-retrieve, it says: "[...] The
> > error can be signaled with (signal ERROR-SYMBOL DATA) [...]",
> > but in current master (grep for ":error" in "lisp/url/*.el") the actual
> > usage is that ERROR-SYMBOL is `error' and DATA is a list that starts
> > with a symbol, for example (connection-failed "failed with code 10061"
> > :host "localhost" :service 80). The docstring hints at something
> > like this:
> >
> >   (url-retrieve (format "http://localhost/non-existent-resource")
> >                 (lambda (status &rest args)
> >                   (let ((error-info (plist-get status :error)))
> >                     (when error-info
> >                       (signal (car error-info) (cdr error-info))))
> >                   ;;...
> >                   ))
>
> I tried finding that doc string, but it doesn't seem to exist any more?
> Was that in the `url-retrieve' doc string?
>

No, it's the best I could come up with given the "hint":
  "The error can be signaled with (signal ERROR-SYMBOL DATA)"
in the url-retrieve docstring.


> ---
> grep --color -nH --null -e "car error-info" `find . -type f`
>
> Grep finished with no matches found at Wed May 15 08:01:26
> ---
>
>
> > which ends up calling this:
> >
> >   (signal 'error
> >           '(connection-failed "failed with code 10061"
> >             :host "localhost"
> >             :service 80))
> >
> > which ends up printing these two lines (including the newline
> > embedded in a string) to the echo area:
> >
> > error in process sentinel: peculiar error: "failed with code 10061
> > ", :host, "localhost", :service, 80
>
> Yeah, that's not the right way to call `error'...
>

Yeah.


> > Unfortunately the error code itself, `connection-failed', is dropped.
> > (See print_error_message in "print.c"; if ERROR-SYMBOL is `error' then
> > the car of DATA, say ERRMSG, is printed if it is a string; if ERRMSG
> > is not a string then "peculiar error" is printed instead of ERRMSG.)
> >
> > Please also consider augmenting the docstring with an example of using
> > the error data. It's a drag for the user to have to work that out
> > before they are in a position to call url-retrieve!
>
> Yup.  But I don't know why that example is gone -- perhaps somebody else
> remembers?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

This bug report was last modified 6 years and 66 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.