Fix ledger_entry error code (#891)

Fix #896
This commit is contained in:
cyan317
2023-10-05 18:11:42 +01:00
committed by GitHub
parent 0b5f667e4a
commit 59eb40a1f2
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",
@@ -1101,8 +1101,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.");
});
}
@@ -1114,7 +1114,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.");
});
}