| 16 | RpcProtocolServerV1::RpcProtocolServerV1(IProcedureInvokationHandler &handler) : AbstractProtocolHandler(handler) {} |
| 17 | |
| 18 | void RpcProtocolServerV1::HandleJsonRequest(const Json::Value &req, Json::Value &response) { |
| 19 | if (req.isObject()) { |
| 20 | int error = this->ValidateRequest(req); |
| 21 | if (error == 0) { |
| 22 | try { |
| 23 | this->ProcessRequest(req, response); |
| 24 | } catch (const JsonRpcException &exc) { |
| 25 | this->WrapException(req, exc, response); |
| 26 | } |
| 27 | } else { |
| 28 | this->WrapError(req, error, Errors::GetErrorMessage(error), response); |
| 29 | } |
| 30 | } else { |
| 31 | this->WrapError(Json::nullValue, Errors::ERROR_RPC_INVALID_REQUEST, Errors::GetErrorMessage(Errors::ERROR_RPC_INVALID_REQUEST), response); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | bool RpcProtocolServerV1::ValidateRequestFields(const Json::Value &request) { |
| 36 | if (!(request.isMember(KEY_REQUEST_METHODNAME) && request[KEY_REQUEST_METHODNAME].isString())) |
no test coverage detected