GNU bug report logs - #64888
28.2; jsonrpc.el; Function jsonrpc-error's error code is not correct

Previous Next

Package: emacs;

Reported by: YI YUE <includeyy123 <at> gmail.com>

Date: Thu, 27 Jul 2023 07:06:02 UTC

Severity: normal

Found in version 28.2

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64888 <at> debbugs.gnu.org, YI YUE <includeyy123 <at> gmail.com>
Subject: Re: bug#64888: 28.2; jsonrpc.el; Function jsonrpc-error's error code
 is not correct
Date: Fri, 28 Jul 2023 09:24:45 +0100
On Fri, Jul 28, 2023 at 7:57 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > Date: Thu, 27 Jul 2023 15:56:20 +0900
> > From: YI YUE <includeyy123 <at> gmail.com>
> >
> > I noticed that in jsonrpc.el, the function `jsonrpc-error' will singal a
> > `jsonrpc-error' error
> >
> > with error code 32603, but in JSON-RPC 2.0 Specification[1], the error code is
> > -32603
>
> João, any comments?  It looks like a simple typo to me, or am I
> missing something?

Yes, it's a typo and an outright bug, according to the docstring,
which is correct.

When an Elisp JSONRPC endpoint request handler explicitly signals an
error with the jsonrpc-error function, the mistaken recorded
code is  sent over the wire to the other endpoint.  When it signals
any other error (more common), the correct -32603 is sent.

So this erroneous code is not displayed to the user
(unless debug-on-error is on) nor is it something
that the jsonrpc.el client application can reasonably consume
and hypothetically need to be bug-compatible with.

However, other arbitrary JSONRPC endpoints (outside of Emacs)
may theoretically have grown some expectation of the bugged value
it they're only ever talking to jsonrpc.el backed endpoints.
But I've never seen this and I don't think this is too likely.

So I'd say we should probably fix this without too much worry.

João




This bug report was last modified 1 year and 296 days ago.

Previous Next


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