From eb116595d4c4b28eedc009eae98e2bba777e0a1b Mon Sep 17 00:00:00 2001 From: Ryan Hill <38674843+RyanUnderhill@users.noreply.github.com> Date: Mon, 28 Feb 2022 00:15:10 -0800 Subject: [PATCH] Add ability to customize ORT_CXX_API_THROW (#10688) --- include/onnxruntime/core/session/onnxruntime_cxx_api.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/onnxruntime/core/session/onnxruntime_cxx_api.h b/include/onnxruntime/core/session/onnxruntime_cxx_api.h index 0007a9d044..b92c0cc2b2 100644 --- a/include/onnxruntime/core/session/onnxruntime_cxx_api.h +++ b/include/onnxruntime/core/session/onnxruntime_cxx_api.h @@ -56,9 +56,13 @@ struct Exception : std::exception { abort(); \ } while (false) #else +// The #ifndef is for the very special case where the user of this library wants to define their own way of handling errors. +// NOTE: This header expects control flow to not continue after calling ORT_CXX_API_THROW +#ifndef ORT_CXX_API_THROW #define ORT_CXX_API_THROW(string, code) \ throw Ort::Exception(string, code) #endif +#endif // This is used internally by the C++ API. This class holds the global variable that points to the OrtApi, it's in a template so that we can define a global variable in a header and make // it transparent to the users of the API.