mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 11:55:51 +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,
 | 
			
		||||
                 Status(RippledError::rpcINVALID_PARAMS, "Invalid field 'taker'.")
 | 
			
		||||
             }},
 | 
			
		||||
            {
 | 
			
		||||
                JS(domain),
 | 
			
		||||
                validation::Type<std::string>{},
 | 
			
		||||
                validation::CustomValidators::uint256HexStringValidator,
 | 
			
		||||
            },
 | 
			
		||||
            {JS(domain),
 | 
			
		||||
             meta::WithCustomError{
 | 
			
		||||
                 validation::Type<std::string>{}, Status(RippledError::rpcDOMAIN_MALFORMED, "Unable to parse domain.")
 | 
			
		||||
             },
 | 
			
		||||
             meta::WithCustomError{
 | 
			
		||||
                 validation::CustomValidators::uint256HexStringValidator,
 | 
			
		||||
                 Status(RippledError::rpcDOMAIN_MALFORMED, "Unable to parse domain.")
 | 
			
		||||
             }},
 | 
			
		||||
            {JS(limit),
 | 
			
		||||
             validation::Type<uint32_t>{},
 | 
			
		||||
             validation::Min(1u),
 | 
			
		||||
 
 | 
			
		||||
@@ -327,8 +327,8 @@ generateParameterBookOffersTestBundles()
 | 
			
		||||
                },
 | 
			
		||||
                "domain": 0
 | 
			
		||||
            })JSON",
 | 
			
		||||
            .expectedError = "invalidParams",
 | 
			
		||||
            .expectedErrorMessage = "Invalid parameters."
 | 
			
		||||
            .expectedError = "domainMalformed",
 | 
			
		||||
            .expectedErrorMessage = "Unable to parse domain."
 | 
			
		||||
        },
 | 
			
		||||
        ParameterTestBundle{
 | 
			
		||||
            .testName = "Domain_InvalidInt",
 | 
			
		||||
@@ -344,8 +344,8 @@ generateParameterBookOffersTestBundles()
 | 
			
		||||
                },
 | 
			
		||||
                "domain": "123"
 | 
			
		||||
            })JSON",
 | 
			
		||||
            .expectedError = "invalidParams",
 | 
			
		||||
            .expectedErrorMessage = "domainMalformed"
 | 
			
		||||
            .expectedError = "domainMalformed",
 | 
			
		||||
            .expectedErrorMessage = "Unable to parse domain."
 | 
			
		||||
        },
 | 
			
		||||
        ParameterTestBundle{
 | 
			
		||||
            .testName = "Domain_InvalidObject",
 | 
			
		||||
@@ -361,8 +361,8 @@ generateParameterBookOffersTestBundles()
 | 
			
		||||
                },
 | 
			
		||||
                "domain": {}
 | 
			
		||||
            })JSON",
 | 
			
		||||
            .expectedError = "invalidParams",
 | 
			
		||||
            .expectedErrorMessage = "Invalid parameters."
 | 
			
		||||
            .expectedError = "domainMalformed",
 | 
			
		||||
            .expectedErrorMessage = "Unable to parse domain."
 | 
			
		||||
        },
 | 
			
		||||
        ParameterTestBundle{
 | 
			
		||||
            .testName = "LimitNotInt",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user