diff --git a/src/main.rs b/src/main.rs index 98843e3..f591749 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,13 @@ fn main() { } fn process_file(path: &str, mode: &Mode) { - let mut content = fs::read_to_string(path).expect("could not read file"); + let mut content = match fs::read_to_string(path) { + Ok(content) => { content }, + Err(error) => { + println!("\x1B[1m{}\x1B[0m: {}", path, error); + return; + } + }; if ends_with_newline(&content) { match mode {