From feb4d29168421e9bc3c5ad5afc0dbd3300ce9a6c Mon Sep 17 00:00:00 2001 From: donpat1to Date: Sun, 31 Aug 2025 19:46:05 +0200 Subject: [PATCH] error handling for deserialize --- WatcherAgent/src/config.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/WatcherAgent/src/config.rs b/WatcherAgent/src/config.rs index c569b26..9f137ab 100644 --- a/WatcherAgent/src/config.rs +++ b/WatcherAgent/src/config.rs @@ -36,6 +36,13 @@ impl Settings { .prefix_separator("_"), ); - builder.build()?.try_deserialize() + let config = builder.build()?; + + // Try to deserialize and provide error message + config.try_deserialize().map_err(|e| { + eprintln!("Configuration error: {}", e); + eprintln!("Required fields: server.url, app.heartbeat_interval_secs, app.metrics_interval_secs, app.port"); + e + }) } }