mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 20:45:00 +02:00
improve error handling in streaming
Signed-off-by: Alexey Aristov <aav@acm.org>
This commit is contained in:
@@ -251,10 +251,16 @@ pub async fn get(request: HttpRequest) -> HandlerResult<HttpResponse> {
|
||||
yield Ok(Bytes::from(inline));
|
||||
},
|
||||
None => {
|
||||
let mut response = s3.get_object().bucket(&CONFIG.s3_bucket).key(parts.data.blob).send().await.unwrap();
|
||||
|
||||
while let Some(bytes) = response.body.next().await {
|
||||
yield Ok(bytes?);
|
||||
match s3.get_object().bucket(&CONFIG.s3_bucket).key(parts.data.blob).send().await {
|
||||
Ok(mut response) => {
|
||||
while let Some(bytes) = response.body.next().await {
|
||||
yield Ok(bytes?);
|
||||
}
|
||||
},
|
||||
Err(error) => {
|
||||
yield Err(std::io::Error::new(std::io::ErrorKind::Other, error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user