summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-08-01 13:33:31 +0100
committerGitHub <noreply@github.com>2024-08-01 14:33:31 +0200
commit8e6b06b89d47c0ce27c2f959be6d8d48ffab5ebf (patch)
treec12d57076e51eb3b2dde31e3c9c9cd503c8d7567
parent9f27bf9144b114bc4d7d9da77f7d55486e3d2c78 (diff)
fix: Don't panic if failed to add system certificate (#24823)
This commit fixes the panic from https://github.com/denoland/deno/issues/24137. I'm not sure if we want to hard error or maybe instead skip with a warning and continue execution.
-rw-r--r--cli/args/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index 7ae003111..3d35d8c36 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -624,6 +624,8 @@ pub enum RootCertStoreLoadError {
UnknownStore(String),
#[error("Unable to add pem file to certificate store: {0}")]
FailedAddPemFile(String),
+ #[error("Unable to add system certificate to certificate store: {0}")]
+ FailedAddSystemCert(String),
#[error("Failed opening CA file: {0}")]
CaFileOpenError(String),
}
@@ -659,7 +661,9 @@ pub fn get_root_cert_store(
for root in roots {
root_cert_store
.add(rustls::pki_types::CertificateDer::from(root.0))
- .expect("Failed to add platform cert to root cert store");
+ .map_err(|e| {
+ RootCertStoreLoadError::FailedAddSystemCert(e.to_string())
+ })?;
}
}
_ => {