From: Otto Moerbeek Date: Tue, 4 Feb 2025 08:33:41 +0000 (+0100) Subject: Nicer error message on private key read or decode failure X-Git-Tag: dnsdist-2.0.0-alpha1~95^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9da62ebf10821ace8dee73af8026631481a8ac25;p=thirdparty%2Fpdns.git Nicer error message on private key read or decode failure --- diff --git a/pdns/recursordist/rec-rust-lib/rust/src/web.rs b/pdns/recursordist/rec-rust-lib/rust/src/web.rs index e9a394d5a4..d131b163af 100644 --- a/pdns/recursordist/rec-rust-lib/rust/src/web.rs +++ b/pdns/recursordist/rec-rust-lib/rust/src/web.rs @@ -959,7 +959,10 @@ pub fn serveweb( .spawn(move || { runtime.block_on(async { while let Some(res) = set.join_next().await { - let msg = format!("{:?}", res); + let msg = match res { + Ok(Err(wrapped)) => format!("{:?}", wrapped), + _ => format!("{:?}", res) + }; rustmisc::error( &ctx.logger, rustmisc::Priority::Error, @@ -1000,7 +1003,15 @@ fn load_private_key(filename: &str) -> std::io::Result Ok(pkey), + Ok(None) => Err( + std::io::Error::new( + std::io::ErrorKind::Other, + format!("failed to parse private key from {}", filename), + )), + Err(e) => Err(e) + } } // impl below needed because the classes are used in the Context, which gets passed around.