1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -05:00

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.
This commit is contained in:
Bartek Iwańczuk 2024-08-01 13:33:31 +01:00 committed by GitHub
parent 9f27bf9144
commit 8e6b06b89d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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())
})?;
}
}
_ => {