MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / JSONErrorReply

Function JSONErrorReply

src/httprpc.cpp:69–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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