utils: Ensure download tracker is finalised on error
Previously we would fail to finalise the download tracker on error.
This ensures that we allow the download tracker to finish *before*
we then propagate any errors.
@@ -243,11 +243,12 @@ fn download_file_(
(Backend::Reqwest, Notification::UsingReqwest)
};
notify_handler(notification);
- download_to_path_with_backend(backend, url, path, resume_from_partial, Some(callback))?;
+ let res =
+ download_to_path_with_backend(backend, url, path, resume_from_partial, Some(callback));
notify_handler(Notification::DownloadFinished);
- Ok(())
+ res.map_err(|e| e.into())
}
pub fn parse_url(url: &str) -> Result<Url> {
