diff --git a/src/rpc/handlers/LedgerEntry.cpp b/src/rpc/handlers/LedgerEntry.cpp index c2c3fd684..d63fe46ec 100644 --- a/src/rpc/handlers/LedgerEntry.cpp +++ b/src/rpc/handlers/LedgerEntry.cpp @@ -83,8 +83,8 @@ LedgerEntryHandler::process(LedgerEntryHandler::Input input, Context const& ctx) { // Must specify 1 of the following fields to indicate what type if (ctx.apiVersion == 1) - return Error{Status{RippledError::rpcINVALID_PARAMS}}; - return Error{Status{ClioError::rpcUNKNOWN_OPTION}}; + return Error{Status{ClioError::rpcUNKNOWN_OPTION}}; + return Error{Status{RippledError::rpcINVALID_PARAMS}}; } // check ledger exists diff --git a/unittests/rpc/handlers/LedgerEntryTests.cpp b/unittests/rpc/handlers/LedgerEntryTests.cpp index 69f64c738..5e71965ef 100644 --- a/unittests/rpc/handlers/LedgerEntryTests.cpp +++ b/unittests/rpc/handlers/LedgerEntryTests.cpp @@ -103,7 +103,7 @@ generateTestValuesForParametersTest() "invalidParams", "ledgerIndexMalformed"}, - ParamTestCaseBundle{"UnknownOption", R"({})", "unknownOption", "Unknown option."}, + ParamTestCaseBundle{"UnknownOption", R"({})", "invalidParams", "Invalid parameters."}, ParamTestCaseBundle{ "InvalidDepositPreauthType", @@ -1094,8 +1094,8 @@ TEST_F(RPCLedgerEntryTest, InvalidEntryTypeVersion2) auto const output = handler.process(req, Context{.yield = yield, .apiVersion = 2}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.error()); - EXPECT_EQ(err.at("error").as_string(), "unknownOption"); - EXPECT_EQ(err.at("error_message").as_string(), "Unknown option."); + EXPECT_EQ(err.at("error").as_string(), "invalidParams"); + EXPECT_EQ(err.at("error_message").as_string(), "Invalid parameters."); }); } @@ -1107,7 +1107,7 @@ TEST_F(RPCLedgerEntryTest, InvalidEntryTypeVersion1) auto const output = handler.process(req, Context{.yield = yield, .apiVersion = 1}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.error()); - EXPECT_EQ(err.at("error").as_string(), "invalidParams"); - EXPECT_EQ(err.at("error_message").as_string(), "Invalid parameters."); + EXPECT_EQ(err.at("error").as_string(), "unknownOption"); + EXPECT_EQ(err.at("error_message").as_string(), "Unknown option."); }); }