changeset 76:73b9a82670e3

better error reporting
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Nov 2015 10:16:19 +0100
parents 3cc0c30da5ea
children 3c71e14e3f10 e7b1d5bca3ff
files Plugin/Configuration.h Plugin/Wado.cpp
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/Configuration.h	Mon Nov 09 09:38:15 2015 +0100
+++ b/Plugin/Configuration.h	Thu Nov 12 10:16:19 2015 +0100
@@ -27,10 +27,12 @@
 #  define REST_RETURN_TYPE     int32_t
 #  define REST_RETURN_SUCCESS  0
 #  define REST_RETURN_FAILURE  -1
+#  define HAS_ERROR_CODE       0
 #else
 #  define REST_RETURN_TYPE     OrthancPluginErrorCode
 #  define REST_RETURN_SUCCESS  OrthancPluginErrorCode_Success
 #  define REST_RETURN_FAILURE  OrthancPluginErrorCode_Plugin
+#  define HAS_ERROR_CODE       1
 #endif
 
 
--- a/Plugin/Wado.cpp	Mon Nov 09 09:38:15 2015 +0100
+++ b/Plugin/Wado.cpp	Thu Nov 12 10:16:19 2015 +0100
@@ -249,7 +249,11 @@
     std::string contentType = "image/jpg";  // By default, JPEG image will be returned
     if (!LocateInstance(instance, contentType, request))
     {
+#if HAS_ERROR_CODE == 1
+      return OrthancPluginErrorCode_UnknownResource;
+#else
       return REST_RETURN_FAILURE;
+#endif
     }
 
     if (contentType == "application/dicom")