From 6f1ae2d06c71175bfbca91f37faeeae5dd484af8 Mon Sep 17 00:00:00 2001 From: Toni Peter Date: Fri, 13 Dec 2024 12:26:04 +0100 Subject: [PATCH] Improve error message for missing openvasd config --- rust/src/openvasd/config.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust/src/openvasd/config.rs b/rust/src/openvasd/config.rs index b71e8905e..35e1fd644 100644 --- a/rust/src/openvasd/config.rs +++ b/rust/src/openvasd/config.rs @@ -333,9 +333,10 @@ impl Config { fn from_file

(path: P) -> Self where - P: AsRef + std::fmt::Display, + P: AsRef + std::fmt::Display + std::fmt::Debug, { - let config = std::fs::read_to_string(path).unwrap(); + let config = std::fs::read_to_string(&path) + .unwrap_or_else(|e| panic!("Failed to read openvasd config from file: {path:?}. {e}")); toml::from_str(&config).unwrap() }