MCPcopy Create free account
hub / github.com/Raptor3um/raptoreum / JSONErrorReply

Function JSONErrorReply

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

Source from the content-addressed store, hash-verified

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