Mercurial > hg > orthanc
diff Plugins/Include/orthanc/OrthancCPlugin.h @ 2957:ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Dec 2018 17:14:55 +0100 |
parents | 9f48722e8508 |
children | 74a5a7fd6e0e |
line wrap: on
line diff
--- a/Plugins/Include/orthanc/OrthancCPlugin.h Mon Dec 03 15:11:42 2018 +0100 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Mon Dec 03 17:14:55 2018 +0100 @@ -119,7 +119,7 @@ #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 4 -#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 2 +#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 3 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) @@ -451,6 +451,7 @@ _OrthancPluginService_SendHttpStatus = 2010, _OrthancPluginService_CompressAndAnswerImage = 2011, _OrthancPluginService_SendMultipartItem2 = 2012, + _OrthancPluginService_SetHttpErrorDetails = 2013, /* Access to the Orthanc database and API */ _OrthancPluginService_GetDicomForInstance = 3000, @@ -6427,6 +6428,42 @@ } + + typedef struct + { + OrthancPluginRestOutput* output; + const char* details; + } _OrthancPluginSetHttpErrorDetails; + + /** + * @brief Provide a detailed description for an HTTP error. + * + * This function sets the detailed description associated with an + * HTTP error. This description will be displayed in the "Details" + * field of the JSON body of the HTTP answer. It is only taken into + * consideration if the REST callback returns an error code that is + * different from "OrthancPluginErrorCode_Success", and if the + * "HttpDescribeErrors" configuration option of Orthanc is set to + * "true". + * + * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). + * @param output The HTTP connection to the client application. + * @param details The details of the error message. + * @ingroup REST + **/ + ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpErrorDetails( + OrthancPluginContext* context, + OrthancPluginRestOutput* output, + const char* details) + { + _OrthancPluginSetHttpErrorDetails params; + params.output = output; + params.details = details; + context->InvokeService(context, _OrthancPluginService_SetHttpErrorDetails, ¶ms); + } + + + #ifdef __cplusplus } #endif