Skip to content

Commit d44e142

Browse files
committed
Give better errors when build-manifest fails
1 parent 513fc80 commit d44e142

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/tools/build-manifest/src/main.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ macro_rules! t {
193193
Err(e) => panic!("{} failed with {}", stringify!($e), e),
194194
}
195195
};
196+
($e:expr, $extra:expr) => {
197+
match $e {
198+
Ok(e) => e,
199+
Err(e) => panic!("{} failed with {}: {}", stringify!($e), e, $extra),
200+
}
201+
};
196202
}
197203

198204
struct Builder {
@@ -584,7 +590,7 @@ impl Builder {
584590
self.shipped_files.insert(name.clone());
585591

586592
let dst = self.output.join(name);
587-
t!(fs::write(&dst, contents));
593+
t!(fs::write(&dst, contents), format!("failed to create manifest {}", dst.display()));
588594
}
589595

590596
fn write_shipped_files(&self, path: &Path) {

src/tools/build-manifest/src/versions.rs

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ impl Versions {
117117
Some(version) => Ok(version.clone()),
118118
None => {
119119
let version_info = self.load_version_from_tarball(package)?;
120+
if *package == PkgType::Rust && version_info.version.is_none() {
121+
panic!("missing version info for toolchain");
122+
}
120123
self.versions.insert(package.clone(), version_info.clone());
121124
Ok(version_info)
122125
}
@@ -131,6 +134,7 @@ impl Versions {
131134
Ok(file) => file,
132135
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
133136
// Missing tarballs do not return an error, but return empty data.
137+
println!("warning: missing tarball {}", tarball.display());
134138
return Ok(VersionInfo::default());
135139
}
136140
Err(err) => return Err(err.into()),

0 commit comments

Comments
 (0)