From 338bf065a454fee76d9dfa9c7a36161cac72309f Mon Sep 17 00:00:00 2001 From: John Newbery Date: Fri, 24 Feb 2017 11:23:38 -0500 Subject: [PATCH] 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. --- src/rpc/protocol.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rpc/protocol.h b/src/rpc/protocol.h index 47e56e712b2..eafb8d9e672 100644 --- a/src/rpc/protocol.h +++ b/src/rpc/protocol.h @@ -31,9 +31,15 @@ enum HTTPStatusCode enum RPCErrorCode { //! 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_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_INVALID_PARAMS = -32602, + // RPC_INTERNAL_ERROR should only be used for genuine errors in bitcoind + // (for exampled datadir corruption). RPC_INTERNAL_ERROR = -32603, RPC_PARSE_ERROR = -32700,