From 0f95be26dc9417d8125f87885088d7c4026404dc Mon Sep 17 00:00:00 2001 From: Sergio <77530549+sergi0g@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:54:07 +0200 Subject: [PATCH] Remove usage of panic --- src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index f9e2cb8..8bbb5d0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -38,7 +38,7 @@ impl Config { None => Ok(String::from("{}")), // Empty config }; if raw_config.is_err() { - panic!( + error!( "Failed to read config file from {}. Are you sure the file exists?", &path.unwrap().to_str().unwrap() ) @@ -50,7 +50,7 @@ impl Config { pub fn parse(&self, raw_config: &str) -> Self { let json = match json::parse(raw_config) { Ok(v) => v, - Err(e) => panic!("Failed to parse config!\n{}", e), + Err(e) => error!("Failed to parse config!\n{}", e), }; // In the code, raw_ means the JsonValue from the parsed config, before it's validated.