diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-02-09 18:58:46 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-02-09 18:58:46 +0800 |
| commit | 707a4e7162ad31c0152592cf28f66a55ca38dfd2 (patch) | |
| tree | 1b3061d96a8a8dc6bf7c75a0ec4f12f3358f5630 /parser/src/error.rs | |
| parent | 204bb6824bf3555b80ca574ca3edb8ea007c89dd (diff) | |
Add FileNotFound variant to Exit enum
Diffstat (limited to 'parser/src/error.rs')
| -rw-r--r-- | parser/src/error.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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, |
