From 707a4e7162ad31c0152592cf28f66a55ca38dfd2 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 9 Feb 2026 18:58:46 +0800 Subject: Add FileNotFound variant to Exit enum --- parser/src/error.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'parser/src/error.rs') diff --git a/parser/src/error.rs b/parser/src/error.rs index b9ac888..b594165 100644 --- a/parser/src/error.rs +++ b/parser/src/error.rs @@ -7,6 +7,7 @@ use unicode_width::UnicodeWidthStr; pub enum Exit { Code(i32), IoError(std::io::Error), + FileNotFound(PathBuf), SyntaxError { content: String, reason: String, @@ -28,6 +29,10 @@ pub fn handle_exit(e: Exit) { match e { Exit::Code(code) => exit(code), Exit::IoError(error) => print_parse_error(error.to_string()), + Exit::FileNotFound(path_buf) => { + eprintln!("File `{}` not found!", path_buf.display()); + exit(1) + } Exit::SyntaxError { content, reason, -- cgit