Skip to content

Commit 0e163d2

Browse files
authored
Merge pull request #2899 from Alexendoo/cleaning-download-panic
Don't panic if cleaning cached downloads fails
2 parents 1218285 + 0fa8ebe commit 0e163d2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

download/src/lib.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ pub fn download_to_path_with_backend(
125125
}()
126126
.map_err(|e| {
127127
// TODO: We currently clear up the cached download on any error, should we restrict it to a subset?
128-
remove_file(path)
129-
.context("cleaning up cached downloads")
130-
.unwrap();
131-
e
128+
if let Err(file_err) = remove_file(path).context("cleaning up cached downloads") {
129+
file_err.context(e)
130+
} else {
131+
e
132+
}
132133
})
133134
}
134135

0 commit comments

Comments
 (0)