Skip to content

Commit 1a9d5ce

Browse files
committed
do not be silent when TLS info/cert is not found
1 parent aa62d0d commit 1a9d5ce

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/tests/verification_real_world/update_valid_ee_certs.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ fn query(domain: &str, path: &str) -> anyhow::Result<()> {
3030
.build()?
3131
.get(url)
3232
.send()?;
33-
let tls_info: Option<&reqwest::tls::TlsInfo> = response.extensions().get();
34-
if let Some(tls_info) = tls_info {
35-
if let Some(der) = tls_info.peer_certificate() {
36-
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join(path);
37-
eprintln!("writing DER of {domain} to {}", path.display());
38-
fs::write(path, der)?;
39-
}
40-
}
33+
let Some(tls_info): Option<&reqwest::tls::TlsInfo> = response.extensions().get() else {
34+
anyhow::bail!("no TLS info found");
35+
};
36+
let Some(der) = tls_info.peer_certificate() else {
37+
anyhow::bail!("no TLS certificate found");
38+
};
39+
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join(path);
40+
eprintln!("writing DER of {domain} to {}", path.display());
41+
fs::write(path, der)?;
4142
Ok(())
4243
}

0 commit comments

Comments
 (0)