Fix and feature
[anna.git] / example / diameter / launcher / Launcher.cpp
index aebebec..2b51caf 100644 (file)
@@ -528,6 +528,13 @@ void Launcher::updateOperatedOriginHostWithMessage(const anna::diameter::codec::
     a_operatedHost = getOriginHost(message);
 }
 
+OriginHost *Launcher::getWorkingNode() const throw(anna::RuntimeException) {
+  if(!a_workingNode)
+    throw anna::RuntimeException("Working node not identified (try to load services)", ANNA_FILE_LOCATION);
+
+  return a_workingNode;
+}
+
 OriginHost *Launcher::getOperatedHost() const throw(anna::RuntimeException) {
   if(!a_operatedHost)
     throw anna::RuntimeException("Node not identified (try to force a specific Origin-Host with 'node' operation)", ANNA_FILE_LOCATION);
@@ -1539,7 +1546,14 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
     std::string args = ((operation.find("dynamic|") == 0) && (op_size > 8)) ? operation.substr(8) : "";
     if (args == "" && op_size != 7)
       throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
-    p.execute(args, response_content);
+    try {
+      p.execute(args, response_content);
+    }
+    catch(anna::RuntimeException &ex) {
+      ex.trace();
+      response_content = ex.asString();
+      return;
+    }
     return;
   }