fix(game downloads): Added error handling for chunk request errors

This commit is contained in:
quexeky
2025-01-20 18:13:25 +11:00
parent f50818697f
commit 4fc0855ba1

View File

@ -267,8 +267,7 @@ impl GameDownloadAgent {
let sender = self.sender.clone(); let sender = self.sender.clone();
// TODO: Error handling let request = match make_request(
let request = make_request(
&client, &client,
&["/api/v1/client/chunk"], &["/api/v1/client/chunk"],
&[ &[
@ -278,8 +277,13 @@ impl GameDownloadAgent {
("chunk", &context.index.to_string()), ("chunk", &context.index.to_string()),
], ],
|r| r.header("Authorization", generate_authorization_header()), |r| r.header("Authorization", generate_authorization_header()),
) ) {
.unwrap(); Ok(request) => request,
Err(e) => {
sender.send(DownloadManagerSignal::Error(ApplicationDownloadError::Communication(e))).unwrap();
continue;
},
};
scope.spawn(move |_| { scope.spawn(move |_| {
match download_game_chunk(context, &self.control_flag, progress_handle, request) match download_game_chunk(context, &self.control_flag, progress_handle, request)