diff --git a/status_cloud/src/main.rs b/status_cloud/src/main.rs index ffb987c..c8225c6 100644 --- a/status_cloud/src/main.rs +++ b/status_cloud/src/main.rs @@ -16,7 +16,21 @@ fn main() -> Result<(), Box> { println!("Opening Config file: {}", args.config_file); println!("File exists: {}", std::fs::metadata(args.config_file.clone()).is_ok()); - let cfg: Config = toml::from_str(std::fs::read_to_string(args.config_file)?.as_str())?; + let file_contents = match std::fs::read_to_string(args.config_file) { + Ok(val) => val, + Err(e) => { + println!("Could not read file: {}", e.to_string()); + return Ok(()); + } + }; + + let cfg: Config = match toml::from_str(file_contents.as_str()) { + Ok(val) => val, + Err(e) => { + println!("Could not parse file: {}", e.to_string()); + return Ok(()); + } + }; let mut body_content: String = format!("*Last Updated:* {} \n", chrono::Local::now().format("%D - %H:%M:%S"));