Quick fixes

This commit is contained in:
Jeremy 2023-09-20 17:46:34 -04:00
parent ddcfbe0a88
commit 33c8cea2f9
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
2 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@
#define CPPTRACE_HPP #define CPPTRACE_HPP
#include <cstdint> #include <cstdint>
#include <cstdio>
#include <exception> #include <exception>
#include <ostream> #include <ostream>
#include <string> #include <string>
@ -122,7 +123,11 @@ namespace cpptrace {
try : trace(generate_raw_trace(skip + 1)) {} try : trace(generate_raw_trace(skip + 1)) {}
catch(const std::exception& e) { catch(const std::exception& e) {
if(!detail::should_absorb_trace_exceptions()) { 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 { const stacktrace& get_resolved_trace() const noexcept {
@ -135,7 +140,11 @@ namespace cpptrace {
} }
} catch(const std::exception& e) { } catch(const std::exception& e) {
if(!detail::should_absorb_trace_exceptions()) { 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; return resolved_trace;

View File

@ -27,7 +27,7 @@
namespace cpptrace { namespace cpptrace {
namespace detail { namespace detail {
std::atomic_bool absorb_trace_exceptions = true; std::atomic_bool absorb_trace_exceptions(true);
} }
CPPTRACE_API CPPTRACE_API