diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 7ae003111f..3d35d8c36d 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()) + })?; } } _ => {