changeset 3669:445bda258245

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Feb 2020 09:04:40 +0100
parents c8d8c3b5f47c
children e64432336055 3c4269229566
files Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Thu Feb 13 18:05:51 2020 +0100
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Fri Feb 14 09:04:40 2020 +0100
@@ -2172,8 +2172,13 @@
   
     if (body.type() != Json::objectValue)
     {
+#if HAS_ORTHANC_EXCEPTION == 1
       throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
                                       "Expected a JSON object in the body");
+#else
+      LogError("Expected a JSON object in the body");
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
+#endif
     }
 
     bool synchronous = true;
@@ -2182,9 +2187,14 @@
     {
       if (body[KEY_SYNCHRONOUS].type() != Json::booleanValue)
       {
+#if HAS_ORTHANC_EXCEPTION == 1
         throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
                                         "Option \"" + std::string(KEY_SYNCHRONOUS) +
                                         "\" must be Boolean");
+#else
+        LogError("Option \"" + std::string(KEY_SYNCHRONOUS) + "\" must be Boolean");
+        ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
+#endif
       }
       else
       {
@@ -2196,9 +2206,14 @@
     {
       if (body[KEY_ASYNCHRONOUS].type() != Json::booleanValue)
       {
+#if HAS_ORTHANC_EXCEPTION == 1
         throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
                                         "Option \"" + std::string(KEY_ASYNCHRONOUS) +
                                         "\" must be Boolean");
+#else
+        LogError("Option \"" + std::string(KEY_ASYNCHRONOUS) + "\" must be Boolean");
+        ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
+#endif
       }
       else
       {
@@ -2212,9 +2227,14 @@
     {
       if (body[KEY_PRIORITY].type() != Json::booleanValue)
       {
+#if HAS_ORTHANC_EXCEPTION == 1
         throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
                                         "Option \"" + std::string(KEY_PRIORITY) +
                                         "\" must be an integer");
+#else
+        LogError("Option \"" + std::string(KEY_PRIORITY) + "\" must be an integer");
+        ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
+#endif
       }
       else
       {