Mercurial > hg > piper-cpp
comparison vamp-json/VampJson.h @ 158:0876b5e67afe
Improve error handling and extend tests for it
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 20 Jan 2017 22:24:44 +0000 |
parents | 807a0a43096e |
children | 59c89b0e9375 |
comparison
equal
deleted
inserted
replaced
157:5699fca64251 | 158:0876b5e67afe |
---|---|
1312 else if (responseType == RRType::Finish) type = "finish"; | 1312 else if (responseType == RRType::Finish) type = "finish"; |
1313 else type = "invalid"; | 1313 else type = "invalid"; |
1314 | 1314 |
1315 json11::Json::object eo; | 1315 json11::Json::object eo; |
1316 eo["code"] = 0; | 1316 eo["code"] = 0; |
1317 eo["message"] = | 1317 |
1318 std::string("error in ") + type + " request: " + errorText; | 1318 if (responseType == RRType::NotValid) { |
1319 eo["message"] = errorText; | |
1320 } else { | |
1321 eo["message"] = | |
1322 std::string("error in ") + type + " request: " + errorText; | |
1323 } | |
1319 | 1324 |
1320 jo["method"] = type; | 1325 jo["method"] = type; |
1321 jo["error"] = eo; | 1326 jo["error"] = eo; |
1322 addId(jo, id); | 1327 addId(jo, id); |
1323 return json11::Json(jo); | 1328 return json11::Json(jo); |