# HG changeset patch
# User Chris Cannam <c.cannam@qmul.ac.uk>
# Date 1471947421 -3600
# Node ID 10ac36b7198a86be9de4f6b368ac7a0f96658c1e
# Parent  55d69b26d4db95d4425a9c0716a7cd6791855a85
Exception handling in adapter code

diff -r 55d69b26d4db -r 10ac36b7198a json/VampJson.h
--- a/json/VampJson.h	Mon Aug 22 17:16:44 2016 +0100
+++ b/json/VampJson.h	Tue Aug 23 11:17:01 2016 +0100
@@ -979,6 +979,23 @@
         return json11::Json(jo);
     }
 
+    static json11::Json
+    fromException(const std::exception &e, RRType responseType) {
+
+        json11::Json::object jo;
+
+        if (responseType == RRType::List) jo["type"] = "list";
+        else if (responseType == RRType::Load) jo["type"] = "load";
+        else if (responseType == RRType::Configure) jo["type"] = "configure";
+        else if (responseType == RRType::Process) jo["type"] = "process";
+        else if (responseType == RRType::Finish) jo["type"] = "finish";
+        else jo["type"] = "invalid";
+
+        jo["success"] = false;
+        jo["errorText"] = std::string("exception caught: ") + e.what();
+        return json11::Json(jo);
+    }
+    
 private: // go private briefly for a couple of helper functions
     
     static void