diff Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 3404:e280ced38a4c

ErrorCode_UnsupportedMediaType
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Jun 2019 18:43:42 +0200
parents 0faae6f6e3c5
children 408ffcb4038f
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Fri Jun 07 17:24:26 2019 +0200
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Fri Jun 07 18:43:42 2019 +0200
@@ -2610,6 +2610,7 @@
 #if HAS_ORTHANC_PLUGIN_HTTP_MULTIPART_SERVER == 1
   static OrthancPluginMultipartRestHandler* MultipartRestFactory(
     OrthancPluginMultipartRestFactory* factory,
+    OrthancPluginErrorCode*            errorCode,
     OrthancPluginHttpMethod            method,
     const char*                        url,
     const char*                        contentType,
@@ -2620,6 +2621,8 @@
     const char* const*                 headersKeys,
     const char* const*                 headersValues)
   {
+    *errorCode = OrthancPluginErrorCode_Success;
+
     try
     {
       assert(factory != NULL);
@@ -2646,11 +2649,13 @@
     catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
     {
       LogError("Exception while creating a multipart handler");
+      *errorCode = static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
       return NULL;
     }
     catch (...)
     {
       LogError("Native exception while creating a multipart handler");
+      *errorCode = OrthancPluginErrorCode_Plugin;
       return NULL;
     }
   }