MCPcopy Create free account
hub / github.com/cinemast/libjson-rpc-cpp / WrapError

Method WrapError

src/jsonrpccpp/server/rpcprotocolserverv2.cpp:75–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void RpcProtocolServerV2::WrapError(const Json::Value &request, int code, const string &message, Json::Value &result) {
76 result["jsonrpc"] = "2.0";
77 result["error"]["code"] = code;
78 result["error"]["message"] = message;
79
80 if (request.isObject() && request.isMember("id") && (request["id"].isNull() || request["id"].isIntegral() || request["id"].isString())) {
81 result["id"] = request["id"];
82 } else {
83 result["id"] = Json::nullValue;
84 }
85}
86
87void RpcProtocolServerV2::WrapException(const Json::Value &request, const JsonRpcException &exception, Json::Value &result) {
88 this->WrapError(request, exception.GetCode(), exception.GetMessage(), result);

Callers 4

HandleJsonRequestMethod · 0.95
HandleSingleRequestMethod · 0.95
HandleBatchRequestMethod · 0.95
WrapExceptionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected