diff Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 2177:11420238f337

ORTHANC_PLUGINS_THROW_EXCEPTION macro
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Nov 2016 12:29:28 +0100
parents fead5549aaa7
children 1d0838b8e9c5
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Fri Nov 25 12:07:36 2016 +0100
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Fri Nov 25 12:29:28 2016 +0100
@@ -44,9 +44,13 @@
 
 #if HAS_ORTHANC_EXCEPTION == 1
 #  include "../../../Core/OrthancException.h"
+#  define ORTHANC_PLUGINS_THROW_EXCEPTION(code)  throw ::Orthanc::OrthancException(static_cast<Orthanc::ErrorCode>(code))
+#else
+#  define ORTHANC_PLUGINS_THROW_EXCEPTION(code)  throw ::OrthancPlugins::PluginException(code)
 #endif
 
 
+
 namespace OrthancPlugins
 {
   typedef void (*RestCallback) (OrthancPluginRestOutput* output,
@@ -56,8 +60,6 @@
   const char* GetErrorDescription(OrthancPluginContext* context,
                                   OrthancPluginErrorCode code);
 
-  void ThrowException(OrthancPluginErrorCode code);
-
 #if HAS_ORTHANC_EXCEPTION == 0
   class PluginException
   {