Add commenting around JSON error codes

RPC_INVALID_REQUEST and RPC_METHOD_NOT_FOUND are mapped internally to
HTTP error codes and should not be used for application-layer errors.
This commit adds commenting around those definitions to warn not to use
them for application errors.
This commit is contained in:
John Newbery 2017-02-24 11:23:38 -05:00
parent dab804c18a
commit 338bf065a4

View file

@ -31,9 +31,15 @@ enum HTTPStatusCode
enum RPCErrorCode enum RPCErrorCode
{ {
//! Standard JSON-RPC 2.0 errors //! Standard JSON-RPC 2.0 errors
// RPC_INVALID_REQUEST is internally mapped to HTTP_BAD_REQUEST (400).
// It should not be used for application-layer errors.
RPC_INVALID_REQUEST = -32600, RPC_INVALID_REQUEST = -32600,
// RPC_METHOD_NOT_FOUND is internally mapped to HTTP_NOT_FOUND (404).
// It should not be used for application-layer errors.
RPC_METHOD_NOT_FOUND = -32601, RPC_METHOD_NOT_FOUND = -32601,
RPC_INVALID_PARAMS = -32602, RPC_INVALID_PARAMS = -32602,
// RPC_INTERNAL_ERROR should only be used for genuine errors in bitcoind
// (for exampled datadir corruption).
RPC_INTERNAL_ERROR = -32603, RPC_INTERNAL_ERROR = -32603,
RPC_PARSE_ERROR = -32700, RPC_PARSE_ERROR = -32700,