Skip to content

Commit

Permalink
Merge pull request #2035 from ecumene/fix-casual-errors
Browse files Browse the repository at this point in the history
Cleaned up error messages
  • Loading branch information
kinnison authored Oct 6, 2019
2 parents 856da77 + 7b53743 commit 97bb7b9
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions src/cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,37 +517,35 @@ pub fn dump_testament() {
}
}

pub fn report_error(e: &Error) {
err!("{}", e);
fn show_backtrace() -> bool {
if let Ok(true) = env::var("RUSTUP_NO_BACKTRACE").map(|s| s == "1") {
return false;
}

for e in e.iter().skip(1) {
info!("caused by: {}", e);
if let Ok(true) = env::var("RUST_BACKTRACE").map(|s| s == "1") {
return true;
}

if show_backtrace() {
if let Some(backtrace) = e.backtrace() {
info!("backtrace:");
println!();
println!("{:?}", backtrace);
for arg in env::args() {
if arg == "-v" || arg == "--verbose" {
return true;
}
} else {
}

fn show_backtrace() -> bool {
if let Ok(true) = env::var("RUSTUP_NO_BACKTRACE").map(|s| s == "1") {
return false;
}
false
}

if let Ok(true) = env::var("RUST_BACKTRACE").map(|s| s == "1") {
return true;
}
pub fn report_error(e: &Error) {
err!("{}", e);

for arg in env::args() {
if arg == "-v" || arg == "--verbose" {
return true;
}
}
for e in e.iter().skip(1) {
err!("caused by: {}", e);
}

false
if show_backtrace() {
if let Some(backtrace) = e.backtrace() {
err!("backtrace:");
err!("{:?}", backtrace);
}
}
}

0 comments on commit 97bb7b9

Please sign in to comment.