Skip to content

Commit d9f8779

Browse files
authored
Improve errors when failing to load certificates (#390)
1 parent bd37836 commit d9f8779

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dropshot/src/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ fn load_certs(filename: &Path) -> std::io::Result<Vec<rustls::Certificate>> {
901901

902902
// Load and return certificate.
903903
rustls_pemfile::certs(&mut reader)
904-
.map_err(|_| error("failed to load certificate".into()))
904+
.map_err(|err| error(format!("failed to load certificate: {err}")))
905905
.map(|mut chain| chain.drain(..).map(rustls::Certificate).collect())
906906
}
907907

@@ -915,7 +915,7 @@ fn load_private_key(filename: &Path) -> std::io::Result<rustls::PrivateKey> {
915915

916916
// Load and return a single private key.
917917
let keys = rustls_pemfile::pkcs8_private_keys(&mut reader)
918-
.map_err(|_| error("failed to load private key".into()))?;
918+
.map_err(|err| error(format!("failed to load private key: {err}")))?;
919919
if keys.len() != 1 {
920920
return Err(error("expected a single private key".into()));
921921
}

0 commit comments

Comments
 (0)