New Ticket

TICKET_CREATE privileges are required to perform this operation. You don't have the required permissions



Login Close


Consistent error codes in XML and JSON RPC

Ticket #210 Assigned to olemis, last modified 12 months ago

Details

Reporter olemis
Keywords error code
Type enhancement
Status accepted
Priority minor
Product rpc
Milestone bhrpc_1.1.3
Component xmlrpc
Version tracrpc_1.1.2
Cc

Description

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 .
Last modified by olemis (diff)
Note: See TracTickets for help on using tickets.

olemis

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.