Added an error message for when the config.json file is missing

This commit is contained in:
Thomas
2024-03-20 15:11:23 +01:00
parent 12cb2d6bd9
commit 2ae74269ea

View File

@@ -40,7 +40,7 @@ impl Config {
} }
pub fn from_json(file_name: String) -> Config { pub fn from_json(file_name: String) -> Config {
let mut file = File::open(file_name).unwrap(); let mut file = File::open(file_name).expect("Error opening config.json file. Go to the readme file and paste the example.");
let mut buf = String::new(); let mut buf = String::new();
file.read_to_string(&mut buf).expect("Error reading config file content."); file.read_to_string(&mut buf).expect("Error reading config file content.");
let json: Value = serde_json::from_str(&buf).expect("Error parsing config file"); let json: Value = serde_json::from_str(&buf).expect("Error parsing config file");