Bläddra i källkod

Use try/catch and debug output when extracting xml

Matt Clarkson 10 år sedan
förälder
incheckning
2df84cb1cc
1 ändrade filer med 17 tillägg och 2 borttagningar
  1. 17 2
      Libs/CommandLineModules/Core/ctkCmdLineModuleManager.cpp

+ 17 - 2
Libs/CommandLineModules/Core/ctkCmdLineModuleManager.cpp

@@ -28,6 +28,8 @@
 #include "ctkCmdLineModuleXmlValidator.h"
 #include "ctkCmdLineModuleReference.h"
 #include "ctkCmdLineModuleReference_p.h"
+#include "ctkCmdLineModuleRunException.h"
+#include "ctkCmdLineModuleXmlException.h"
 
 #include <ctkException.h>
 
@@ -39,7 +41,7 @@
 #include <QHash>
 #include <QList>
 #include <QMutex>
-
+#include <QDebug>
 #include <QFuture>
 
 #if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
@@ -188,7 +190,20 @@ ctkCmdLineModuleManager::registerModule(const QUrl &location)
   }
   else
   {
-    xml = backend->rawXmlDescription(location);
+    try
+    {
+      xml = backend->rawXmlDescription(location);
+    }
+    catch (const ctkCmdLineModuleRunException& e)
+    {
+      qDebug() << "Extracting XML from " << e.location().toString() << " failed with errorCode " << e.errorCode() << " and return string " << e.errorString();
+      throw;
+    }
+    catch (const ctkException& e)
+    {
+      qDebug() << e.what();
+      throw;
+    }
   }
 
   if (xml.isEmpty())