We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b986c86 commit 9446815Copy full SHA for 9446815
src/error.rs
@@ -71,8 +71,19 @@ impl Error {
71
///
72
/// [tracking]: https://github.com/rust-lang/rust/issues/53487
73
#[cfg(backtrace)]
74
- pub fn backtrace(&self) -> &std::backtrace::Backtrace {
75
- self.error.backtrace()
+ pub fn backtrace(&self) -> Option<&std::backtrace::Backtrace> {
+ let backtrace = self.error.backtrace();
76
+ if let std::backtrace::BacktraceStatus::Captured = backtrace.status() {
77
+ Some(backtrace)
78
+ } else {
79
+ None
80
+ }
81
82
+
83
+ #[cfg(not(backtrace))]
84
+ #[allow(missing_docs)]
85
+ pub fn backtrace(&self) -> Option<()> {
86
87
}
88
89
/// Attempt to downcast the error object to a concrete type.
0 commit comments