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

Function JSONErrorReply

src/httprpc.cpp:58–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56static HTTPRPCTimerInterface* httpRPCTimerInterface = 0;
57
58static void JSONErrorReply(HTTPRequest* req, const UniValue& objError, const UniValue& id)
59{
60 // Send error reply from json-rpc error object
61 int nStatus = HTTP_INTERNAL_SERVER_ERROR;
62 int code = find_value(objError, "code").get_int();
63
64 if (code == RPC_INVALID_REQUEST)
65 nStatus = HTTP_BAD_REQUEST;
66 else if (code == RPC_METHOD_NOT_FOUND)
67 nStatus = HTTP_NOT_FOUND;
68
69 std::string strReply = JSONRPCReply(NullUniValue, objError, id);
70
71 req->WriteHeader("Content-Type", "application/json");
72 req->WriteReply(nStatus, strReply);
73}
74
75static bool RPCAuthorized(const std::string& strAuth)
76{

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