# HG changeset patch # User Alain Mazy # Date 1786444725 -7200 # Node ID 83b3ccf70aadbf0ea5f2e30854f4528e4c8ee8b1 # Parent cb0c18b038bc53c61e51b3dfc93198404828760e fix logs when issuing exceptions from a plugin diff -r cb0c18b038bc -r 83b3ccf70aad Resources/Orthanc/Plugins/OrthancPluginException.h --- 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(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) \