From 420fe0db5f967ff8253ee985d23c7d600c0db7c6 Mon Sep 17 00:00:00 2001 From: Stridsvagn69420 Date: Sun, 4 Dec 2022 19:44:19 +0100 Subject: [PATCH] Verbose error output --- src/bin/cyrkensia.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bin/cyrkensia.rs b/src/bin/cyrkensia.rs index d6e7c13..434c96e 100644 --- a/src/bin/cyrkensia.rs +++ b/src/bin/cyrkensia.rs @@ -37,9 +37,16 @@ async fn server(cfg: Config) -> io::Result<()> { let bindaddr = cfg.bindaddr.clone(); let unbound_server = HttpServer::new(move || { // Initialize state - let Ok(state) = CyrkensiaState::new(cfg.clone()) else { - eprintln!("Cyrkensia failed trying to initialize!"); - exit(1); + let state = match CyrkensiaState::new(cfg.clone()) { + Ok(val) => val, + Err(err) => { + let red: &str = Colors::RedBright.as_ref(); + eprintln!( + "{red}{}\x1b[0m\n{err}", + timelog!("Cyrkensia failed trying to initialize:") + ); + exit(1); + } }; // ---- App ----