comparison vamp-json/VampJson.h @ 180:bd543e74a9bf

Correct the inspection of the JSON object in successful to look for both error and success objects, writing out an error string if neither are present. Revert error handling in readInput() for JSON.
author Lucas Thompson <dev@lucas.im>
date Fri, 03 Feb 2017 11:12:27 +0000
parents 1990dd9570d8
children 03b067abd91d
comparison
equal deleted inserted replaced
179:0e13b7b80464 180:bd543e74a9bf
1107 } 1107 }
1108 } 1108 }
1109 1109
1110 static bool 1110 static bool
1111 successful(json11::Json j, std::string &err) { 1111 successful(json11::Json j, std::string &err) {
1112 if (!j["result"].is_object()) { 1112 if (j["result"].is_object()) {
1113 err = "result object expected for success"; 1113 return true;
1114 } else if (j["error"].is_object()) {
1114 return false; 1115 return false;
1115 } 1116 } else {
1116 return true; 1117 err = "result or error object required for valid response";
1118 return false;
1119 }
1117 } 1120 }
1118 1121
1119 static void 1122 static void
1120 markRPC(json11::Json::object &jo) { 1123 markRPC(json11::Json::object &jo) {
1121 jo["jsonrpc"] = "2.0"; 1124 jo["jsonrpc"] = "2.0";