comparison 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
comparison
equal deleted inserted replaced
3403:630fc934597f 3404:e280ced38a4c
2608 ******************************************************************/ 2608 ******************************************************************/
2609 2609
2610 #if HAS_ORTHANC_PLUGIN_HTTP_MULTIPART_SERVER == 1 2610 #if HAS_ORTHANC_PLUGIN_HTTP_MULTIPART_SERVER == 1
2611 static OrthancPluginMultipartRestHandler* MultipartRestFactory( 2611 static OrthancPluginMultipartRestHandler* MultipartRestFactory(
2612 OrthancPluginMultipartRestFactory* factory, 2612 OrthancPluginMultipartRestFactory* factory,
2613 OrthancPluginErrorCode* errorCode,
2613 OrthancPluginHttpMethod method, 2614 OrthancPluginHttpMethod method,
2614 const char* url, 2615 const char* url,
2615 const char* contentType, 2616 const char* contentType,
2616 const char* subType, 2617 const char* subType,
2617 uint32_t groupsCount, 2618 uint32_t groupsCount,
2618 const char* const* groups, 2619 const char* const* groups,
2619 uint32_t headersCount, 2620 uint32_t headersCount,
2620 const char* const* headersKeys, 2621 const char* const* headersKeys,
2621 const char* const* headersValues) 2622 const char* const* headersValues)
2622 { 2623 {
2624 *errorCode = OrthancPluginErrorCode_Success;
2625
2623 try 2626 try
2624 { 2627 {
2625 assert(factory != NULL); 2628 assert(factory != NULL);
2626 MultipartRestCallback& that = *reinterpret_cast<MultipartRestCallback*>(factory); 2629 MultipartRestCallback& that = *reinterpret_cast<MultipartRestCallback*>(factory);
2627 2630
2644 subType == NULL ? "" : subType, g, headers)); 2647 subType == NULL ? "" : subType, g, headers));
2645 } 2648 }
2646 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) 2649 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
2647 { 2650 {
2648 LogError("Exception while creating a multipart handler"); 2651 LogError("Exception while creating a multipart handler");
2652 *errorCode = static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
2649 return NULL; 2653 return NULL;
2650 } 2654 }
2651 catch (...) 2655 catch (...)
2652 { 2656 {
2653 LogError("Native exception while creating a multipart handler"); 2657 LogError("Native exception while creating a multipart handler");
2658 *errorCode = OrthancPluginErrorCode_Plugin;
2654 return NULL; 2659 return NULL;
2655 } 2660 }
2656 } 2661 }
2657 2662
2658 static OrthancPluginErrorCode MultipartRestAddPart( 2663 static OrthancPluginErrorCode MultipartRestAddPart(