# HG changeset patch # User Alain Mazy # Date 1786444693 -7200 # Node ID cb558bd6ba67cc1e7beae307dab72c5539d0f5ea # Parent de713a31cbd3de483c421add6dcc5d931903ee76 fix logs when issuing exceptions from a plugin diff -r de713a31cbd3 -r cb558bd6ba67 OrthancServer/Plugins/Samples/Common/OrthancPluginException.h --- a/OrthancServer/Plugins/Samples/Common/OrthancPluginException.h Tue Aug 11 12:37:18 2026 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginException.h Tue Aug 11 12:38:13 2026 +0200 @@ -48,11 +48,16 @@ errorCode, #errorCode " triggered from " __ORTHANC_FILE__ ":" \ PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE(__LINE__)) +# define PLUGIN_THROW_WITH_FILE_AND_LINE_INFO_HELPER(errorCode, errorCodeStr) \ + throw ::Orthanc::OrthancException( \ + errorCode, "Plugin error code " + errorCodeStr + " triggered from " __ORTHANC_FILE__ ":" \ + PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE(__LINE__)) + # define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code) \ - PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(static_cast(code)) + PLUGIN_THROW_WITH_FILE_AND_LINE_INFO_HELPER(static_cast(code), boost::lexical_cast(code)) # define ORTHANC_PLUGINS_THROW_EXCEPTION(code) \ - PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(ORTHANC_PLUGINS_GET_ERROR_CODE(code)) + PLUGIN_THROW_WITH_FILE_AND_LINE_INFO_HELPER(ORTHANC_PLUGINS_GET_ERROR_CODE(code), boost::lexical_cast(ORTHANC_PLUGINS_GET_ERROR_CODE(code))) #else // the PluginException does not accept a detail argument # define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code) \