Skip to content

Commit feb6234

Browse files
committed
check 404
1 parent e99cbe8 commit feb6234

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ci/svd2rust-regress/src/svd_test.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{Context, Result};
1+
use anyhow::{anyhow, Context, Result};
22
use svd2rust::{util::ToSanitizedCase, Target};
33

44
use crate::{command::CommandExt, tests::TestCase, Opts, TestOpts};
@@ -213,10 +213,14 @@ impl TestCase {
213213
}
214214
tracing::info!("Downloading SVD");
215215
// FIXME: Avoid downloading multiple times, especially if we're using the diff command
216-
let svd = reqwest::blocking::get(self.svd_url())
217-
.with_context(|| "Failed to get svd URL")?
216+
let svd_url = &self.svd_url();
217+
let svd = reqwest::blocking::get(svd_url)
218+
.with_context(|| format!("Failed to get svd URL: {svd_url}"))?
218219
.text()
219220
.with_context(|| "SVD is bad text")?;
221+
if svd == "404: Not Found" {
222+
return Err(anyhow!("Failed to get svd URL: {svd_url}. {svd}").into());
223+
}
220224
let chip_svd = format!("{}.svd", &self.chip);
221225
let svd_file = path_helper_base(&chip_dir, &[&chip_svd]);
222226
file_helper(&svd, &svd_file)?;

0 commit comments

Comments
 (0)