Refactor RPC commands with no arguments.

This commit is contained in:
Arthur Britto
2012-12-02 18:08:45 -08:00
parent 318c7d15cb
commit c6db85fb39
6 changed files with 124 additions and 61 deletions

View File

@@ -77,11 +77,14 @@ Json::Value WSConnection::invokeCommand(Json::Value& jvRequest)
// Currently we will simply unwrap errors returned by the RPC
// API, in the future maybe we can make the responses
// consistent.
//
// Regularize result. This is duplicate code.
if (jvResult["result"].isObject() && jvResult["result"].isMember("error"))
{
jvResult = jvResult["result"];
jvResult = jvResult["result"];
jvResult["status"] = "error";
jvResult["request"] = jvRequest;
} else {
jvResult["status"] = "success";
}