mirror of
https://github.com/actix/actix-web.git
synced 2024-11-14 04:41:15 +00:00
always provide backtrace for error
This commit is contained in:
parent
acd7380865
commit
b07d0e712f
1 changed files with 4 additions and 4 deletions
|
@ -48,11 +48,11 @@ impl Error {
|
|||
|
||||
/// Returns a reference to the Backtrace carried by this error, if it
|
||||
/// carries one.
|
||||
pub fn backtrace(&self) -> Option<&Backtrace> {
|
||||
pub fn backtrace(&self) -> &Backtrace {
|
||||
if let Some(bt) = self.cause.backtrace() {
|
||||
Some(bt)
|
||||
bt
|
||||
} else {
|
||||
self.backtrace.as_ref()
|
||||
self.backtrace.as_ref().unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_backtrace() {
|
||||
let e = ErrorBadRequest("err");
|
||||
assert!(e.backtrace().is_some());
|
||||
let _ = e.backtrace();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue