diff OrthancServer/main.cpp @ 1650:9f34ebfaf2c9

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Sep 2015 16:47:05 +0200
parents 8040d56cb0b3
children 2e692c83e2f3
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Fri Sep 25 16:24:13 2015 +0200
+++ b/OrthancServer/main.cpp	Fri Sep 25 16:47:05 2015 +0200
@@ -327,6 +327,23 @@
                       HttpMethod method,
                       const char* uri)
   {
+    {
+      bool isPlugin = false;
+
+#if ORTHANC_PLUGINS_ENABLED == 1
+      if (plugins_ != NULL)
+      {
+        plugins_->GetErrorDictionary().LogError(exception);
+        isPlugin = true;
+      }
+#endif
+
+      if (!isPlugin)
+      {
+        LOG(ERROR) << "Exception in the HTTP handler: " << exception.What();
+      }
+    }      
+
     Json::Value message = Json::objectValue;
     ErrorCode errorCode = exception.GetErrorCode();
     HttpStatus httpStatus = exception.GetHttpStatus();
@@ -338,8 +355,6 @@
       if (plugins_ != NULL &&
           plugins_->GetErrorDictionary().Format(message, httpStatus, exception))
       {
-        LOG(ERROR) << "Error code " << message["PluginCode"].asInt() << " inside plugin \"" 
-                   << message["PluginName"].asString() << "\": " << message["Message"].asString();
         errorCode = ErrorCode_Plugin;
         isPlugin = true;
       }
@@ -347,7 +362,6 @@
 
       if (!isPlugin)
       {
-        LOG(ERROR) << "Exception in the HTTP handler: " << exception.What();
         message["Message"] = exception.What();
       }
     }