summaryrefslogtreecommitdiff
path: root/src/macro_processor/main.rs
diff options
context:
space:
mode:
authorQrius <[email protected]>2024-09-26 00:11:05 +0200
committerQrius <[email protected]>2024-09-26 00:11:05 +0200
commite6ab276a4d5daaf0dd40eed5e2ff477b48187f77 (patch)
treed9394d87b428d15e45706b7f3de0eda4cbddeb0e /src/macro_processor/main.rs
parente489f7d9f8b799ee1605b4d5cb65fe7adf24ea22 (diff)
downloadskaldpress-e6ab276a4d5daaf0dd40eed5e2ff477b48187f77.tar.gz
skaldpress-e6ab276a4d5daaf0dd40eed5e2ff477b48187f77.zip
Change return of MacroProcessor to Result
Diffstat (limited to 'src/macro_processor/main.rs')
-rw-r--r--src/macro_processor/main.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/macro_processor/main.rs b/src/macro_processor/main.rs
index 247fc85..2d34952 100644
--- a/src/macro_processor/main.rs
+++ b/src/macro_processor/main.rs
@@ -4,9 +4,17 @@ use std::fs;
fn main() {
let args: Vec<String> = env::args().collect();
- let input_file = fs::read_to_string(&args[1]).expect("Failed to read input file");
+ let input_file = match fs::read_to_string(&args[1]) {
+ Ok(x) => x,
+ Err(e) => {
+ println!("Could not read input-file \"{}\": {}", args[1], e);
+ std::process::exit(1);
+ }
+ };
let mut macro_processor = MacroProcessor::new();
- let final_output = macro_processor.process_input(&input_file);
- println!("{}", final_output);
+ match macro_processor.process_input(&input_file) {
+ Ok(out) => println!("{}", out),
+ Err(e) => println!("Error {}", e),
+ }
}