Skip to content

Commit 14493a4

Browse files
authored
Improve release error messages when conversion failed (#334)
1 parent ad49e1f commit 14493a4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/release.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ pub fn convert_to_install_only<W: Write>(reader: impl BufRead, writer: W) -> Res
230230
let mut json_data = vec![];
231231
entry.read_to_end(&mut json_data)?;
232232

233-
let json_main = parse_python_json(&json_data)?;
233+
let json_main = parse_python_json(&json_data).context("failed to parse PYTHON.json")?;
234234

235235
let stdlib_path = json_main
236236
.python_paths
@@ -383,7 +383,11 @@ pub fn convert_to_stripped<W: Write>(
383383
pub fn produce_install_only(tar_zst_path: &Path) -> Result<PathBuf> {
384384
let buf = std::fs::read(tar_zst_path)?;
385385

386-
let gz_data = convert_to_install_only(std::io::Cursor::new(buf), std::io::Cursor::new(vec![]))?
386+
let gz_data = convert_to_install_only(std::io::Cursor::new(buf), std::io::Cursor::new(vec![]))
387+
.context(format!(
388+
"failed to convert `{}` to install_only",
389+
tar_zst_path.display()
390+
))?
387391
.into_inner();
388392

389393
let filename = tar_zst_path
@@ -417,7 +421,11 @@ pub fn produce_install_only_stripped(tar_gz_path: &Path, llvm_dir: &Path) -> Res
417421
std::io::Cursor::new(buf),
418422
std::io::Cursor::new(vec![]),
419423
llvm_dir,
420-
)?
424+
)
425+
.context(format!(
426+
"failed to convert `{}` to install_only_stripped",
427+
tar_gz_path.display()
428+
))?
421429
.into_inner();
422430

423431
let size_after = gz_data.len();

0 commit comments

Comments
 (0)