Skip to content

Commit

Permalink
Update to latest nightly Backtrace
Browse files Browse the repository at this point in the history
Closes: #376
  • Loading branch information
iovxw committed Jun 23, 2023
1 parent 6c1e5f1 commit 8eac9f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![feature(backtrace)]
#![feature(error_generic_member_access, provide_any)]
#![recursion_limit = "256"]

use std::backtrace::Backtrace;
use std::convert::TryInto;
use std::env;
use std::panic;
Expand Down Expand Up @@ -159,9 +160,9 @@ fn init_proxy() -> Option<Proxy> {

fn print_error<E: std::error::Error>(err: E) {
eprintln!("Error: {}", err);
let mut deepest_backtrace = err.backtrace();

let mut err: &dyn std::error::Error = &err;
let mut deepest_backtrace = err.request_ref::<Backtrace>();
if let Some(e) = err.source() {
eprintln!("\nCaused by:");
let multiple = e.source().is_some();
Expand All @@ -173,7 +174,7 @@ fn print_error<E: std::error::Error>(err: E) {
eprint!(" ")
};
eprintln!("{}", e);
if let Some(backtrace) = e.backtrace() {
if let Some(backtrace) = e.request_ref::<Backtrace>() {
deepest_backtrace = Some(backtrace);
}
err = e;
Expand Down

0 comments on commit 8eac9f2

Please sign in to comment.