download error handling

This commit is contained in:
Robin Appelman 2024-01-27 17:41:10 +01:00
commit 12a6ab3e95
2 changed files with 4 additions and 1 deletions

View file

@ -91,6 +91,9 @@ pub async fn download_config(
"Done" => { "Done" => {
break; break;
} }
_ if status.starts_with("Error") => {
return Err(DownloadError::Unknown(status.into()).into());
}
_ => {} _ => {}
} }
} }

View file

@ -65,7 +65,7 @@ pub enum DownloadError {
#[error("Invalid file type")] #[error("Invalid file type")]
InvalidFileType, InvalidFileType,
#[error("Received error code: {0}")] #[error("Received error code: {0}")]
Unknown(u32), Unknown(String),
#[error("Mismatched payload length, expected {0} got {1}")] #[error("Mismatched payload length, expected {0} got {1}")]
MismatchedLength(u32, u32), MismatchedLength(u32, u32),
#[error("Received an invalid md5 hash")] #[error("Received an invalid md5 hash")]