mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-12 07:45:52 +00:00
fix: Return domainMalformed when domain is malformed (#2228)
Fix: https://github.com/XRPLF/clio/issues/2222 Code in rippled to handle errors: https://github.com/XRPLF/rippled/blob/2.5.0-rc1/src/xrpld/rpc/handlers/BookOffers.cpp#L183
This commit is contained in:
@@ -148,11 +148,14 @@ public:
|
|||||||
validation::CustomValidators::accountValidator,
|
validation::CustomValidators::accountValidator,
|
||||||
Status(RippledError::rpcINVALID_PARAMS, "Invalid field 'taker'.")
|
Status(RippledError::rpcINVALID_PARAMS, "Invalid field 'taker'.")
|
||||||
}},
|
}},
|
||||||
{
|
{JS(domain),
|
||||||
JS(domain),
|
meta::WithCustomError{
|
||||||
validation::Type<std::string>{},
|
validation::Type<std::string>{}, Status(RippledError::rpcDOMAIN_MALFORMED, "Unable to parse domain.")
|
||||||
validation::CustomValidators::uint256HexStringValidator,
|
},
|
||||||
},
|
meta::WithCustomError{
|
||||||
|
validation::CustomValidators::uint256HexStringValidator,
|
||||||
|
Status(RippledError::rpcDOMAIN_MALFORMED, "Unable to parse domain.")
|
||||||
|
}},
|
||||||
{JS(limit),
|
{JS(limit),
|
||||||
validation::Type<uint32_t>{},
|
validation::Type<uint32_t>{},
|
||||||
validation::Min(1u),
|
validation::Min(1u),
|
||||||
|
|||||||
@@ -327,8 +327,8 @@ generateParameterBookOffersTestBundles()
|
|||||||
},
|
},
|
||||||
"domain": 0
|
"domain": 0
|
||||||
})JSON",
|
})JSON",
|
||||||
.expectedError = "invalidParams",
|
.expectedError = "domainMalformed",
|
||||||
.expectedErrorMessage = "Invalid parameters."
|
.expectedErrorMessage = "Unable to parse domain."
|
||||||
},
|
},
|
||||||
ParameterTestBundle{
|
ParameterTestBundle{
|
||||||
.testName = "Domain_InvalidInt",
|
.testName = "Domain_InvalidInt",
|
||||||
@@ -344,8 +344,8 @@ generateParameterBookOffersTestBundles()
|
|||||||
},
|
},
|
||||||
"domain": "123"
|
"domain": "123"
|
||||||
})JSON",
|
})JSON",
|
||||||
.expectedError = "invalidParams",
|
.expectedError = "domainMalformed",
|
||||||
.expectedErrorMessage = "domainMalformed"
|
.expectedErrorMessage = "Unable to parse domain."
|
||||||
},
|
},
|
||||||
ParameterTestBundle{
|
ParameterTestBundle{
|
||||||
.testName = "Domain_InvalidObject",
|
.testName = "Domain_InvalidObject",
|
||||||
@@ -361,8 +361,8 @@ generateParameterBookOffersTestBundles()
|
|||||||
},
|
},
|
||||||
"domain": {}
|
"domain": {}
|
||||||
})JSON",
|
})JSON",
|
||||||
.expectedError = "invalidParams",
|
.expectedError = "domainMalformed",
|
||||||
.expectedErrorMessage = "Invalid parameters."
|
.expectedErrorMessage = "Unable to parse domain."
|
||||||
},
|
},
|
||||||
ParameterTestBundle{
|
ParameterTestBundle{
|
||||||
.testName = "LimitNotInt",
|
.testName = "LimitNotInt",
|
||||||
|
|||||||
Reference in New Issue
Block a user