MCPcopy Create free account
hub / github.com/bitcoin-sv/bitcoin-sv / JSONErrorReply

Function JSONErrorReply

src/httprpc.cpp:66–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64static std::string strRPCCORSDomain;
65
66static void JSONErrorReply(HTTPRequest *req, const UniValue &objError,
67 const UniValue &id) {
68 // Send error reply from json-rpc error object.
69 int nStatus = HTTP_INTERNAL_SERVER_ERROR;
70 int code = find_value(objError, "code").get_int();
71
72 if (code == RPC_INVALID_REQUEST)
73 nStatus = HTTP_BAD_REQUEST;
74 else if (code == RPC_METHOD_NOT_FOUND)
75 nStatus = HTTP_NOT_FOUND;
76
77 std::string strReply = JSONRPCReply(NullUniValue, objError, id);
78
79 req->WriteHeader("Content-Type", "application/json");
80 req->WriteReply(nStatus, strReply);
81}
82
83// This function checks username and password against -rpcauth entries from
84// config file.

Callers 1

HTTPReq_JSONRPCFunction · 0.85

Calls 4

JSONRPCReplyFunction · 0.85
get_intMethod · 0.80
WriteHeaderMethod · 0.80
WriteReplyMethod · 0.80

Tested by

no test coverage detected