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 c29011a commit 4c188ffCopy full SHA for 4c188ff
src/error.rs
@@ -85,8 +85,19 @@ impl Error {
85
///
86
/// [tracking]: https://github.com/rust-lang/rust/issues/53487
87
#[cfg(backtrace)]
88
- pub fn backtrace(&self) -> &std::backtrace::Backtrace {
89
- self.error.backtrace()
+ pub fn backtrace(&self) -> Option<&std::backtrace::Backtrace> {
+ let backtrace = self.error.backtrace();
90
+ if let std::backtrace::BacktraceStatus::Captured = backtrace.status() {
91
+ Some(backtrace)
92
+ } else {
93
+ None
94
+ }
95
96
+
97
+ #[cfg(not(backtrace))]
98
+ #[allow(missing_docs)]
99
+ pub fn backtrace(&self) -> Option<()> {
100
101
}
102
103
/// Attempt to downcast the error object to a concrete type.
0 commit comments