comparison json/VampJson.h @ 43:62c17e143aba

Simple test script (and associated fixes) for the JS code
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 24 Aug 2016 10:50:40 +0100
parents 10ac36b7198a
children a98ef4c2616b
comparison
equal deleted inserted replaced
42:91f5c92d3bf7 43:62c17e143aba
981 981
982 static json11::Json 982 static json11::Json
983 fromException(const std::exception &e, RRType responseType) { 983 fromException(const std::exception &e, RRType responseType) {
984 984
985 json11::Json::object jo; 985 json11::Json::object jo;
986 986 std::string type;
987 if (responseType == RRType::List) jo["type"] = "list"; 987
988 else if (responseType == RRType::Load) jo["type"] = "load"; 988 if (responseType == RRType::List) type = "list";
989 else if (responseType == RRType::Configure) jo["type"] = "configure"; 989 else if (responseType == RRType::Load) type = "load";
990 else if (responseType == RRType::Process) jo["type"] = "process"; 990 else if (responseType == RRType::Configure) type = "configure";
991 else if (responseType == RRType::Finish) jo["type"] = "finish"; 991 else if (responseType == RRType::Process) type = "process";
992 else jo["type"] = "invalid"; 992 else if (responseType == RRType::Finish) type = "finish";
993 993 else type = "invalid";
994
995 jo["type"] = type;
994 jo["success"] = false; 996 jo["success"] = false;
995 jo["errorText"] = std::string("exception caught: ") + e.what(); 997 jo["errorText"] = std::string("exception caught: ") +
998 type + " request: " + e.what();
996 return json11::Json(jo); 999 return json11::Json(jo);
997 } 1000 }
998 1001
999 private: // go private briefly for a couple of helper functions 1002 private: // go private briefly for a couple of helper functions
1000 1003