Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 3404:e280ced38a4c
ErrorCode_UnsupportedMediaType
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 07 Jun 2019 18:43:42 +0200 |
parents | 962e5f00744b |
children | b7728227a852 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Fri Jun 07 17:24:26 2019 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Fri Jun 07 18:43:42 2019 +0200 @@ -4247,14 +4247,30 @@ continue; } + OrthancPluginErrorCode errorCode = OrthancPluginErrorCode_Plugin; + OrthancPluginMultipartRestHandler* handler = (*it)->GetParameters().createHandler( - (*it)->GetParameters().factory, + (*it)->GetParameters().factory, &errorCode, convertedMethod, matcher.GetFlatUri().c_str(), contentType.c_str(), subType.c_str(), matcher.GetGroupsCount(), matcher.GetGroups(), headers.size(), headers.empty() ? NULL : &headersKeys[0], headers.empty() ? NULL : &headersValues[0]); - return new MultipartStream(handler, (*it)->GetParameters(), boundary, GetErrorDictionary()); + if (handler == NULL) + { + if (errorCode == OrthancPluginErrorCode_Success) + { + // Ignore: The factory cannot create a handler for this request + } + else + { + throw OrthancException(static_cast<ErrorCode>(errorCode)); + } + } + else + { + return new MultipartStream(handler, (*it)->GetParameters(), boundary, GetErrorDictionary()); + } } }