Skip to content

Commit 48885db

Browse files
committed
Bump
1 parent 77ac48a commit 48885db

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

engine/src/server/mod.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ async fn resolve_http(request: &Request, state: Data<&State>) -> impl IntoRespon
6262

6363
// stream file from s3 storage and return it
6464
let s3_path = deployment_file.file_hash.clone();
65-
if let Ok(s3_data) = state.storage.bucket.get_object_stream(s3_path).await {
66-
// Stream the S3 response bytes directly to the client
67-
let stream = s3_data.bytes.map(|chunk| {
68-
chunk.map_err(|e| {
65+
match state.storage.bucket.get_object_stream(s3_path).await {
66+
Ok(s3_data) => {
67+
// Stream the S3 response bytes directly to the client
68+
let stream = s3_data.bytes.map(|chunk| {
69+
chunk.map_err(|e| {
6970
info!("Error streaming file: {}", e);
7071
std::io::Error::new(std::io::ErrorKind::Other, e)
7172
})
@@ -76,8 +77,14 @@ async fn resolve_http(request: &Request, state: Data<&State>) -> impl IntoRespon
7677
.status(StatusCode::OK)
7778
.header("content-type", deployment_file.deployment_file_mime_type.clone())
7879
.body(body);
79-
} else {
80-
info!("File not found in s3");
80+
}
81+
Err(e) => {
82+
info!("Error streaming file: {}", e);
83+
84+
return Response::builder()
85+
.status(StatusCode::INTERNAL_SERVER_ERROR)
86+
.body(Body::from_string(e.to_string()))
87+
}
8188
}
8289
} else {
8390
info!("No file found");

0 commit comments

Comments
 (0)