mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 10:05:48 +00:00
fix: Error consistency in LedgerEntry::parsePermissionedDomains() (#5252)
Update errors for parsing permissioned domains in the LedgerEntry handler to make them consistent with other parsers.
This commit is contained in:
@@ -3810,7 +3810,7 @@ public:
|
||||
params[jss::ledger_index] = jss::validated;
|
||||
params[jss::permissioned_domain] = "NotAHexString";
|
||||
auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
|
||||
checkErrorValue(jrr[jss::result], "malformedObjectId", "");
|
||||
checkErrorValue(jrr[jss::result], "malformedRequest", "");
|
||||
}
|
||||
|
||||
{
|
||||
@@ -3819,7 +3819,7 @@ public:
|
||||
params[jss::ledger_index] = jss::validated;
|
||||
params[jss::permissioned_domain] = 10;
|
||||
auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
|
||||
checkErrorValue(jrr[jss::result], "malformedObject", "");
|
||||
checkErrorValue(jrr[jss::result], "malformedRequest", "");
|
||||
}
|
||||
|
||||
{
|
||||
@@ -3829,7 +3829,7 @@ public:
|
||||
params[jss::permissioned_domain][jss::account] = 1;
|
||||
params[jss::permissioned_domain][jss::seq] = seq;
|
||||
auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
|
||||
checkErrorValue(jrr[jss::result], "malformedAccount", "");
|
||||
checkErrorValue(jrr[jss::result], "malformedRequest", "");
|
||||
}
|
||||
|
||||
{
|
||||
@@ -3839,7 +3839,7 @@ public:
|
||||
params[jss::permissioned_domain][jss::account] = "";
|
||||
params[jss::permissioned_domain][jss::seq] = seq;
|
||||
auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
|
||||
checkErrorValue(jrr[jss::result], "malformedAccount", "");
|
||||
checkErrorValue(jrr[jss::result], "malformedAddress", "");
|
||||
}
|
||||
|
||||
{
|
||||
@@ -3849,7 +3849,7 @@ public:
|
||||
params[jss::permissioned_domain][jss::account] = alice.human();
|
||||
params[jss::permissioned_domain][jss::seq] = "12g";
|
||||
auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
|
||||
checkErrorValue(jrr[jss::result], "malformedSequence", "");
|
||||
checkErrorValue(jrr[jss::result], "malformedRequest", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -998,22 +998,19 @@ parsePermissionedDomains(Json::Value const& pd, Json::Value& jvResult)
|
||||
{
|
||||
if (pd.isString())
|
||||
{
|
||||
Json::Value result;
|
||||
auto const index = parseIndex(pd, result);
|
||||
if (!index)
|
||||
jvResult[jss::error] = "malformedObjectId";
|
||||
auto const index = parseIndex(pd, jvResult);
|
||||
return index;
|
||||
}
|
||||
|
||||
if (!pd.isObject())
|
||||
{
|
||||
jvResult[jss::error] = "malformedObject";
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!pd.isMember(jss::account) || !pd[jss::account].isString())
|
||||
{
|
||||
jvResult[jss::error] = "malformedAccount";
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -1021,14 +1018,14 @@ parsePermissionedDomains(Json::Value const& pd, Json::Value& jvResult)
|
||||
(pd[jss::seq].isInt() && pd[jss::seq].asInt() < 0) ||
|
||||
(!pd[jss::seq].isInt() && !pd[jss::seq].isUInt()))
|
||||
{
|
||||
jvResult[jss::error] = "malformedSequence";
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto const account = parseBase58<AccountID>(pd[jss::account].asString());
|
||||
if (!account)
|
||||
{
|
||||
jvResult[jss::error] = "malformedAccount";
|
||||
jvResult[jss::error] = "malformedAddress";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user