Skip to content

Commit

Permalink
feat(main): make use of the new results and backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Aug 21, 2023
1 parent e29a02c commit 5567474
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,32 @@ struct Args {
}

fn main() {
let res = actual_main();

if let Err(err) = res {
eprintln!("Error:\n{err}");
#[cfg(feature = "backtrace")]
{
let backtrace = err.backtrace().to_string();

if backtrace == "disabled backtrace" {
eprintln!(
"note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace"
);
} else {
eprintln!("{}", backtrace);
}
}
#[cfg(not(feature = "backtrace"))]
{
eprintln!("backtrace support is disabled, enable feature \"backtrace\"");
}

std::process::exit(1);
}
}

fn actual_main() -> anyhow::Result<()> {
let args: Args = Args::from_args();
let cols = args.autogenerated_columns.unwrap_or_default();
let mut default_table_options = TableOptions::default()
Expand Down Expand Up @@ -104,5 +130,7 @@ fn main() {
schema_path: args.schema_path.unwrap_or("crate::schema::".to_owned()),
model_path: args.model_path.unwrap_or("crate::models::".to_owned()),
},
);
)?;

Ok(())
}

0 comments on commit 5567474

Please sign in to comment.