Skip to content

Commit

Permalink
chore(console): improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
nrskt committed Apr 12, 2022
1 parent 0a77d61 commit c87ddfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 6 additions & 1 deletion tokio-console/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,12 @@ impl ConfigFile {
.and_then(|path| fs::read_to_string(path).ok())
.map(|raw| toml::from_str::<ConfigFile>(&raw))
.transpose()
.wrap_err_with(|| format!("failed to parse {:?}", path.into_path()))?;
.wrap_err_with(|| {
format!(
"failed to parse {}",
path.into_path().unwrap_or_default().display()
)
})?;
Ok(config)
}

Expand Down
8 changes: 1 addition & 7 deletions tokio-console/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ mod warnings;

#[tokio::main]
async fn main() -> color_eyre::Result<()> {
let mut args = match config::Config::from_config() {
Err(e) => {
eprintln!("failed to parse config file: {:#?}", e);
std::process::exit(1);
}
Ok(args) => args,
};
let mut args = config::Config::from_config()?;
let retain_for = args.retain_for();
args.trace_init()?;
tracing::debug!(?args.target_addr, ?args.view_options);
Expand Down

0 comments on commit c87ddfc

Please sign in to comment.