mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Better error messages for out of range integral values
* This change passes detailed error messages from the JSON parser on the server side, back to the client for inclusion into the reply's error message. * Errors originating from the server's inability to parse are reclassified from rpcINTERNAL to rpcINVALID_PARAMS.
This commit is contained in:
@@ -121,6 +121,20 @@ class LedgerRPC_test : public beast::unit_test::suite
|
||||
checkErrorValue(jrr, "invalidParams", "Invalid parameters.");
|
||||
}
|
||||
|
||||
{
|
||||
// Request a ledger with a very large (double) sequence.
|
||||
auto const ret = env.rpc (
|
||||
"json", "ledger", "{ \"ledger_index\" : 2e15 }");
|
||||
BEAST_EXPECT (RPC::contains_error(ret));
|
||||
BEAST_EXPECT (ret[jss::error_message] == "Invalid parameters.");
|
||||
}
|
||||
|
||||
{
|
||||
// Request a ledger with very large (integer) sequence.
|
||||
auto const ret = env.rpc (
|
||||
"json", "ledger", "{ \"ledger_index\" : 1000000000000000 }");
|
||||
checkErrorValue(ret, "invalidParams", "Invalid parameters.");
|
||||
}
|
||||
}
|
||||
|
||||
void testLedgerCurrent()
|
||||
|
||||
@@ -893,7 +893,7 @@ class ServerStatus_test :
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
doHTTPRequest(env, yield, false, resp, ec, "{}");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Unable to parse request\r\n");
|
||||
BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n");
|
||||
}
|
||||
|
||||
Json::Value jv;
|
||||
|
||||
Reference in New Issue
Block a user