Skip to content

Commit 338bf06

Browse files
committed
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.
1 parent dab804c commit 338bf06

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/rpc/protocol.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ enum HTTPStatusCode
3131
enum RPCErrorCode
3232
{
3333
//! Standard JSON-RPC 2.0 errors
34+
// RPC_INVALID_REQUEST is internally mapped to HTTP_BAD_REQUEST (400).
35+
// It should not be used for application-layer errors.
3436
RPC_INVALID_REQUEST = -32600,
37+
// RPC_METHOD_NOT_FOUND is internally mapped to HTTP_NOT_FOUND (404).
38+
// It should not be used for application-layer errors.
3539
RPC_METHOD_NOT_FOUND = -32601,
3640
RPC_INVALID_PARAMS = -32602,
41+
// RPC_INTERNAL_ERROR should only be used for genuine errors in bitcoind
42+
// (for exampled datadir corruption).
3743
RPC_INTERNAL_ERROR = -32603,
3844
RPC_PARSE_ERROR = -32700,
3945

0 commit comments

Comments
 (0)