Subject: bug#64888: closed (Re: bug#64888: 28.2; jsonrpc.el; Function jsonrpc-error's error code is not correct)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 29 Jul 2023 10:15:02 +0000

Your bug report

#64888: 28.2; jsonrpc.el; Function jsonrpc-error's error code is not correct

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64888: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64888
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#64888: 28.2; jsonrpc.el; Function jsonrpc-error's error code is not correct
From: João Távora <[email-masked]>
To: Eli Zaretskii <[email-masked]>, [email-masked]
Cc: YI YUE <[email-masked]>
Date: Sat, 29 Jul 2023 11:16:29 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I've fixed this in master, commit 2af83f215ce83eda5a3eba21c352e6cd7435fbb1.

Closing.

On Fri, Jul 28, 2023 at 9:24 AM João Távora <[email-masked]> wrote:
>
> On Fri, Jul 28, 2023 at 7:57 AM Eli Zaretskii <[email-masked]> wrote:
> >
> > > Date: Thu, 27 Jul 2023 15:56:20 +0900
> > > From: YI YUE <[email-masked]>
> > >
> > > 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

-- 
João Távora

Subject: 28.2; jsonrpc.el; Function jsonrpc-error's error code is not correct
From: YI YUE <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Thu, 27 Jul 2023 15:56:20 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

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

Here is the original code starts at jsonrpc.el line 224:

(signal 'jsonrpc-error

`(,msg

(jsonrpc-error-code . ,32603)

(jsonrpc-error-message . ,msg)))

I think it should be:

(signal 'jsonrpc-error

`(,msg

(jsonrpc-error-code . -32603)

(jsonrpc-error-message . ,msg)))

Regards.

[1]: https://www.jsonrpc.org/specification