MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ErrorReply

Function ErrorReply

src/rpc/core/rpcserver.cpp:260–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260static void ErrorReply(HTTPRequest* req, const json_spirit::Object& objError,
261 const json_spirit::Value& id) {
262 // Send error reply from json-rpc error object
263 int nStatus = HTTP_INTERNAL_SERVER_ERROR;
264 Value codeObj = json_spirit::find_value(objError, "code");
265 if (codeObj.type() == int_type) {
266 int code = codeObj.get_int();
267
268 if (code == RPC_INVALID_REQUEST)
269 nStatus = HTTP_BAD_REQUEST;
270 else if (code == RPC_METHOD_NOT_FOUND)
271 nStatus = HTTP_NOT_FOUND;
272 }
273 std::string strReply = JSONRPCReply(Value::null, objError, id);
274 req->WriteHeader("Content-Type", "application/json");
275 req->WriteReply(nStatus, strReply);
276}
277
278static bool InitRPCAuthentication() {
279 strRPCUserColonPass =

Callers 1

JsonRPCHandlerFunction · 0.85

Calls 5

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

Tested by

no test coverage detected