mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-16 17:20:33 +00:00
feat: enhance error handling and add precondition checks for object o… (#1008)
This commit is contained in:
@@ -41,6 +41,11 @@ pub async fn read_full<R: AsyncRead + Send + Sync + Unpin>(mut reader: R, mut bu
|
||||
if total == 0 {
|
||||
return Err(e);
|
||||
}
|
||||
// If the error is InvalidData (e.g., checksum mismatch), preserve it
|
||||
// instead of wrapping it as UnexpectedEof, so proper error handling can occur
|
||||
if e.kind() == std::io::ErrorKind::InvalidData {
|
||||
return Err(e);
|
||||
}
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::UnexpectedEof,
|
||||
format!("read {total} bytes, error: {e}"),
|
||||
|
||||
Reference in New Issue
Block a user