Opened 6 years ago

Last modified 6 years ago

#210 accepted enhancement

Consistent error codes in XML and JSON RPC

Reported by: olemis Owned by: olemis
Priority: minor Milestone: bhrpc_1.1.3
Component: xmlrpc Version: tracrpc_1.1.2
Keywords: error code Cc:

Description (last modified by olemis)

Handling of (XML|JSON)-RPC error codes does not seem to be consistent. I mean , I've been running plugin test suite using JSON-RPC. When matching error codes for expected failures I get some failures with message AssertionError: 1 != -32603. About this situation I have a few comments :

  1. JSON-RPC error codes are exactly the same as XML-RPC error codes
  2. In the test suite expected error code is 1 , which is outputted by XML-RPC plugin ...
  3. ... whereas JSON-RPC outputs standard -32603 under similar circumstanes
  4. There are cases (e.g. tracrpc.tests.xml_rpc: ) that fit into another error category (e.g. -32602)
  5. Standard code -32601 is used when requested method is not found, as expected.

Proposed changes are :

  1. to make XML-RPC output -32603 code on internal server errors
  2. to ouput -32602 code if request arguments do not comply with method signature.

Otherwise it's possible to

  1. force JSON-RPC to output 1 as error code instead .

Change History (5)

comment:1 Changed 6 years ago by olemis

  • Component set to xmlrpc
  • Keywords error code added
  • Owner set to olemis
  • Priority changed from major to minor
  • Version set to bhrpc_1.1.3

comment:2 Changed 6 years ago by olemis

  • Description modified (diff)

comment:3 Changed 6 years ago by olemis

  • Description modified (diff)
  • Milestone set to bhrpc_1.1.3
  • Version bhrpc_1.1.3 deleted

comment:4 Changed 6 years ago by olemis

  • Version set to tracrpc_1.1.2

comment:5 Changed 6 years ago by olemis

  • Status changed from new to accepted

An initial solution has been implemented in 5bd64a1ea661/rpc, 1fcab53317d1/rpc, 99e8faac6e23/rpc, 3cfdb51125f9/rpc. Signature contract violations are detected by probing dummy functions looking for TypeError, see 0bb7753a1d98/rpc.

Note: See TracTickets for help on using tickets.