From 75c858dca2e13b7f8f2e4da062c30d3fd92a26a0 Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Tue, 22 Feb 2022 14:41:52 +0000 Subject: [PATCH] MGMT - Improve invalid rpc param error description and some cleanup. --- mgmt2/rpc/jsonrpc/error/RPCError.cc | 6 +++--- mgmt2/rpc/jsonrpc/unit_tests/test_basic_protocol.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mgmt2/rpc/jsonrpc/error/RPCError.cc b/mgmt2/rpc/jsonrpc/error/RPCError.cc index 8cbe96f497e..6cbb10b870d 100644 --- a/mgmt2/rpc/jsonrpc/error/RPCError.cc +++ b/mgmt2/rpc/jsonrpc/error/RPCError.cc @@ -21,7 +21,7 @@ #include "RPCError.h" #include -#include // TODO: remove +#include namespace { // anonymous namespace @@ -66,7 +66,7 @@ RPCErrorCategory::message(int ev) const return {"Missing method field"}; // params case RPCErrorCode::InvalidParamType: - return {"Invalid params type, should be a structure"}; + return {"Invalid params type. A Structured value is expected"}; // id case RPCErrorCode::InvalidIdType: return {"Invalid id type"}; @@ -90,4 +90,4 @@ make_error_code(rpc::error::RPCErrorCode e) return {static_cast(e), rpcErrorCategory}; } -} // namespace rpc::error \ No newline at end of file +} // namespace rpc::error diff --git a/mgmt2/rpc/jsonrpc/unit_tests/test_basic_protocol.cc b/mgmt2/rpc/jsonrpc/unit_tests/test_basic_protocol.cc index 543394b23a4..ffe272a2d9c 100644 --- a/mgmt2/rpc/jsonrpc/unit_tests/test_basic_protocol.cc +++ b/mgmt2/rpc/jsonrpc/unit_tests/test_basic_protocol.cc @@ -302,7 +302,7 @@ TEST_CASE("Invalid parameters base on the jsonrpc 2.0 protocol", "[protocol]") REQUIRE(resp); const std::string_view expected = - R"({"jsonrpc": "2.0", "error": {"code": 6, "message": "Invalid params type, should be a structure"}, "id": "13"})"; + R"({"jsonrpc": "2.0", "error": {"code": 6, "message": "Invalid params type. A Structured value is expected"}, "id": "13"})"; REQUIRE(*resp == expected); } }