Fix for exception::exception init list exception handling, for real
This commit is contained in:
parent
96df7a1876
commit
d1af192a3c
@ -112,10 +112,16 @@ namespace cpptrace {
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
CPPTRACE_API bool should_absorb_trace_exceptions();
|
CPPTRACE_API bool should_absorb_trace_exceptions();
|
||||||
|
}
|
||||||
|
|
||||||
raw_trace wrapped_generate_raw_trace(uint32_t skip) noexcept {
|
class exception : public std::exception {
|
||||||
|
protected:
|
||||||
|
mutable raw_trace trace;
|
||||||
|
mutable stacktrace resolved_trace;
|
||||||
|
mutable std::string resolved_what;
|
||||||
|
explicit exception(uint32_t skip) noexcept : trace([skip] () noexcept {
|
||||||
try {
|
try {
|
||||||
return generate_raw_trace(skip + 1);
|
return generate_raw_trace(skip + 2);
|
||||||
} catch(const std::exception& e) {
|
} catch(const std::exception& e) {
|
||||||
if(!detail::should_absorb_trace_exceptions()) {
|
if(!detail::should_absorb_trace_exceptions()) {
|
||||||
fprintf(
|
fprintf(
|
||||||
@ -126,15 +132,7 @@ namespace cpptrace {
|
|||||||
}
|
}
|
||||||
return raw_trace({});
|
return raw_trace({});
|
||||||
}
|
}
|
||||||
}
|
} ()) {}
|
||||||
}
|
|
||||||
|
|
||||||
class exception : public std::exception {
|
|
||||||
protected:
|
|
||||||
mutable raw_trace trace;
|
|
||||||
mutable stacktrace resolved_trace;
|
|
||||||
mutable std::string resolved_what;
|
|
||||||
explicit exception(uint32_t skip) noexcept : trace(detail::wrapped_generate_raw_trace(skip + 1)) {}
|
|
||||||
const stacktrace& get_resolved_trace() const noexcept {
|
const stacktrace& get_resolved_trace() const noexcept {
|
||||||
// I think a non-empty raw trace can never resolve as empty, so this will accurately prevent resolving more
|
// I think a non-empty raw trace can never resolve as empty, so this will accurately prevent resolving more
|
||||||
// than once. Either way the raw trace is cleared.
|
// than once. Either way the raw trace is cleared.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user