Skip to content

Commit

Permalink
Manually catch & print errors in main()
Browse files Browse the repository at this point in the history
This lets us ensure that we see the Display impls intead of the Debug
impls, which are generally less useful.
  • Loading branch information
cmyr committed Aug 23, 2023
1 parent bdce702 commit 65948b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fontc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ use fontbe::orchestration::Context as BeContext;
use fontc::{init_paths, write_font_file, Args, ChangeDetector, Config, Error};
use fontir::orchestration::Context as FeContext;

fn main() -> Result<(), Error> {
fn main() {
// catch and print errors manually, to avoid just seeing the Debug impls
if let Err(e) = run() {
// we have a CI check that forbids eprintln, but we're very clever, so
let _ = writeln!(std::io::stderr(), "{e}");
std::process::exit(1);
}
}

fn run() -> Result<(), Error> {
env_logger::builder()
.format(|buf, record| {
let ts = buf.timestamp_micros();
Expand Down

0 comments on commit 65948b0

Please sign in to comment.