Skip to content

Commit 987c34b

Browse files
Implement boost::throw_exception with location (#1636)
It has been added in boost v1.73 Relates-To: MINOR Signed-off-by: Rustam Gamidov <[email protected]>
1 parent a7b48c7 commit 987c34b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

olp-cpp-sdk-core/src/utils/BoostExceptionHandle.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <stdlib.h>
2727
#include <exception>
2828

29+
#include <boost/version.hpp>
30+
2931
namespace {
3032
constexpr auto kLogTag = "BoostExceptionHandle";
3133
}
@@ -36,5 +38,13 @@ OLP_CPP_SDK_DECL_EXPORT void throw_exception(const std::exception& e) {
3638
OLP_SDK_LOG_ABORT_F(kLogTag, "Exception occurred: '%s'", e.what());
3739
}
3840

41+
#if BOOST_VERSION >= 107300
42+
OLP_CPP_SDK_DECL_EXPORT void throw_exception(
43+
const std::exception& e, boost::source_location const& loc) {
44+
OLP_SDK_LOG_ABORT_F(kLogTag, "Exception occurred: '%s' location: '%s'",
45+
e.what(), loc.to_string().c_str());
46+
}
47+
#endif
48+
3949
} // namespace boost
4050
#endif

0 commit comments

Comments
 (0)