Mercurial > hg > orthanc-dicomweb
changeset 777:83b3ccf70aad
fix logs when issuing exceptions from a plugin
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Tue, 11 Aug 2026 12:38:45 +0200 |
| parents | cb0c18b038bc |
| children | a7b50450570c |
| files | Resources/Orthanc/Plugins/OrthancPluginException.h |
| diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/Orthanc/Plugins/OrthancPluginException.h Mon Aug 10 10:22:23 2026 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginException.h Tue Aug 11 12:38:45 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<ORTHANC_PLUGINS_ERROR_ENUMERATION>(code)) + PLUGIN_THROW_WITH_FILE_AND_LINE_INFO_HELPER(static_cast<ORTHANC_PLUGINS_ERROR_ENUMERATION>(code), boost::lexical_cast<std::string>(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<std::string>(ORTHANC_PLUGINS_GET_ERROR_CODE(code))) #else // the PluginException does not accept a detail argument # define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code) \
