mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Make sure that handlers always return Json::objectValue.
This commit is contained in:
@@ -140,17 +140,9 @@ Json::Value RPCHandler::doCommand (
|
||||
LoadEvent::autoptr ev = getApp().getJobQueue().getLoadEventAP(
|
||||
jtGENERIC, "cmd:" + strCommand);
|
||||
RPC::Context context {params, loadType, netOps_, infoSub_, role_};
|
||||
Json::Value jvRaw = handler->method_(context);
|
||||
|
||||
// Regularize result.
|
||||
if (jvRaw.isObject ())
|
||||
return jvRaw;
|
||||
|
||||
// Probably got a string.
|
||||
Json::Value jvResult (Json::objectValue);
|
||||
jvResult[jss::message] = jvRaw;
|
||||
|
||||
return jvResult;
|
||||
auto result = handler->method_(context);
|
||||
assert (result.isObject());
|
||||
return result;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user