mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 07:16:56 -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:
parent
9f27bf9144
commit
8e6b06b89d
1 changed files with 5 additions and 1 deletions
|
@ -624,6 +624,8 @@ pub enum RootCertStoreLoadError {
|
||||||
UnknownStore(String),
|
UnknownStore(String),
|
||||||
#[error("Unable to add pem file to certificate store: {0}")]
|
#[error("Unable to add pem file to certificate store: {0}")]
|
||||||
FailedAddPemFile(String),
|
FailedAddPemFile(String),
|
||||||
|
#[error("Unable to add system certificate to certificate store: {0}")]
|
||||||
|
FailedAddSystemCert(String),
|
||||||
#[error("Failed opening CA file: {0}")]
|
#[error("Failed opening CA file: {0}")]
|
||||||
CaFileOpenError(String),
|
CaFileOpenError(String),
|
||||||
}
|
}
|
||||||
|
@ -659,7 +661,9 @@ pub fn get_root_cert_store(
|
||||||
for root in roots {
|
for root in roots {
|
||||||
root_cert_store
|
root_cert_store
|
||||||
.add(rustls::pki_types::CertificateDer::from(root.0))
|
.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())
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue