fix: Error message for ledger_entry rpc (#5344)

Changes the error to `malformedAddress` for `permissioned_domain` in the `ledger_entry` rpc, when the account is not a string. This change makes it more clear to a user what is wrong with their request.
This commit is contained in:
Sergey Kuznetsov
2025-03-17 13:14:49 +00:00
committed by GitHub
parent c0299dba88
commit d9b7a2688f
2 changed files with 19 additions and 2 deletions

View File

@@ -822,12 +822,18 @@ parsePermissionedDomains(Json::Value const& pd, Json::Value& jvResult)
return std::nullopt;
}
if (!pd.isMember(jss::account) || !pd[jss::account].isString())
if (!pd.isMember(jss::account))
{
jvResult[jss::error] = "malformedRequest";
return std::nullopt;
}
if (!pd[jss::account].isString())
{
jvResult[jss::error] = "malformedAddress";
return std::nullopt;
}
if (!pd.isMember(jss::seq) ||
(pd[jss::seq].isInt() && pd[jss::seq].asInt() < 0) ||
(!pd[jss::seq].isInt() && !pd[jss::seq].isUInt()))