Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsc: Log failures to upload blob #1623

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions rust/rsc/src/bin/rsc/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,18 @@ pub async fn create_blob(
})))
.await;

if let Err(msg) = result {
return (
StatusCode::INTERNAL_SERVER_ERROR,
Json(PostBlobResponse::Error {
message: msg.to_string(),
}),
);
}

let (blob_key, blob_size) = result.unwrap();
let (blob_key, blob_size) = match result {
Err(err) => {
tracing::error! {%err, "Failed to stream blob to store"};
return (
StatusCode::INTERNAL_SERVER_ERROR,
Json(PostBlobResponse::Error {
message: err.to_string(),
}),
);
}
Ok(resp) => resp,
};

let active_blob = blob::ActiveModel {
id: NotSet,
Expand All @@ -87,13 +89,14 @@ pub async fn create_blob(
};

match database::upsert_blob(db.as_ref(), active_blob).await {
Err(msg) => {
Err(err) => {
tracing::error! {%err, "Failed to upsert blob"};
return (
StatusCode::INTERNAL_SERVER_ERROR,
Json(PostBlobResponse::Error {
message: msg.to_string(),
message: err.to_string(),
}),
)
);
}
Ok(id) => parts.push(PostBlobResponsePart { id, name }),
}
Expand Down
Loading