From cbe2b96295dec1d695577605cc4b89736e0b1f23 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 13 Mar 2023 19:59:21 +0100 Subject: [PATCH] [Configuration] Change error message --- src/daemon/configuration/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/daemon/configuration/mod.rs b/src/daemon/configuration/mod.rs index 8f83f1f..294a921 100644 --- a/src/daemon/configuration/mod.rs +++ b/src/daemon/configuration/mod.rs @@ -10,9 +10,10 @@ pub struct Configuration { impl Configuration { pub fn read_or_create() -> Self { let path = std::path::Path::new("configuration.yml"); - let file = std::fs::File::open(path).unwrap(); + let file = std::fs::File::open(path) + .map_err(|_| format!("No such file configuration.yml")) + .unwrap(); let buffer = std::io::BufReader::new(file); - use std::io::Read; serde_yaml::from_reader(buffer).unwrap() }