MCPcopy Create free account
hub / github.com/ElementsProject/elements / JSONErrorReply

Function JSONErrorReply

src/httprpc.cpp:78–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76static bool g_rpc_whitelist_default = false;
77
78static void JSONErrorReply(HTTPRequest* req, const UniValue& objError, const UniValue& id)
79{
80 // Send error reply from json-rpc error object
81 int nStatus = HTTP_INTERNAL_SERVER_ERROR;
82 int code = find_value(objError, "code").get_int();
83
84 if (code == RPC_INVALID_REQUEST)
85 nStatus = HTTP_BAD_REQUEST;
86 else if (code == RPC_METHOD_NOT_FOUND)
87 nStatus = HTTP_NOT_FOUND;
88
89 std::string strReply = JSONRPCReply(NullUniValue, objError, id);
90
91 req->WriteHeader("Content-Type", "application/json");
92 req->WriteReply(nStatus, strReply);
93}
94
95//This function checks username and password against -rpcauth
96//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