Skip to content

Commit 1c02e38

Browse files
committed
Handle JoinError in registry download task results
The unwrap() on the JoinResult from spawned download tasks would panic if a task panicked or was cancelled. Now maps the JoinError to a proper RegistryDownloadFailure error variant instead.
1 parent e1e684a commit 1c02e38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/wac-resolver/src/registry.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ impl RegistryPackageResolver {
153153
let mut finished = 0;
154154

155155
while let Some(res) = tasks.next().await {
156-
let (index, download) = res.unwrap()?;
156+
let (index, download) = res.map_err(|e| Error::RegistryDownloadFailure {
157+
source: anyhow::anyhow!("download task panicked: {e}"),
158+
})??;
157159

158160
finished += 1;
159161

0 commit comments

Comments
 (0)