diff --git a/include/cpptrace/cpptrace.hpp b/include/cpptrace/cpptrace.hpp index e1f12a3..6daadf2 100644 --- a/include/cpptrace/cpptrace.hpp +++ b/include/cpptrace/cpptrace.hpp @@ -2,6 +2,7 @@ #define CPPTRACE_HPP #include +#include #include #include #include @@ -122,7 +123,11 @@ namespace cpptrace { try : trace(generate_raw_trace(skip + 1)) {} catch(const std::exception& e) { if(!detail::should_absorb_trace_exceptions()) { - std::rethrow_exception(std::current_exception()); + fprintf( + stderr, + "Exception ocurred while resolving trace in cpptrace::exception object:\n%s\n", + e.what() + ); } } const stacktrace& get_resolved_trace() const noexcept { @@ -135,7 +140,11 @@ namespace cpptrace { } } catch(const std::exception& e) { if(!detail::should_absorb_trace_exceptions()) { - std::rethrow_exception(std::current_exception()); + fprintf( + stderr, + "Exception ocurred while resolving trace in cpptrace::exception object:\n%s\n", + e.what() + ); } } return resolved_trace; diff --git a/src/cpptrace.cpp b/src/cpptrace.cpp index e2d7a9e..f573f15 100644 --- a/src/cpptrace.cpp +++ b/src/cpptrace.cpp @@ -27,7 +27,7 @@ namespace cpptrace { namespace detail { - std::atomic_bool absorb_trace_exceptions = true; + std::atomic_bool absorb_trace_exceptions(true); } CPPTRACE_API