Fix ledger_entry error code (#891)

Fix #896
This commit is contained in:
cyan317
2023-10-05 18:11:42 +01:00
committed by Alex Kremer
parent 2ef766a740
commit c634f0f0ba
2 changed files with 7 additions and 7 deletions

View File

@@ -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

View File

@@ -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.");
});
}