From 035ec791c5a3688de3af37a1ea355f4d10db3b0d Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Thu, 28 Nov 2024 08:43:26 +0000 Subject: [PATCH] Improve error message --- shaperglot-cli/src/check.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shaperglot-cli/src/check.rs b/shaperglot-cli/src/check.rs index 73eef31..20ef53b 100644 --- a/shaperglot-cli/src/check.rs +++ b/shaperglot-cli/src/check.rs @@ -27,7 +27,12 @@ pub struct CheckArgs { } pub fn check_command(args: &CheckArgs, language_database: shaperglot::Languages) { - let font_binary = std::fs::read(args.font.as_path()).expect("Failed to read font file"); + let font_binary = std::fs::read(args.font.as_path()) + .map_err(|e| { + eprintln!("Failed to read font file {}: {}", args.font.display(), e); + std::process::exit(1); + }) + .unwrap(); let checker = Checker::new(&font_binary).expect("Failed to load font"); let mut fixes_required = HashMap::new(); for language in args.languages.iter() {