Skip to content

Commit 1e31b23

Browse files
authored
client-api: Fix publish error reporting (#1750)
1 parent dd699c4 commit 1e31b23

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

crates/client-api/src/routes/database.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,20 @@ pub async fn publish<S: NodeDelegate + ControlStateDelegate>(
754754
.await
755755
.map_err(log_and_500)?;
756756

757-
if let Some(UpdateDatabaseResult::AutoMigrateError(errs)) = maybe_updated {
758-
return Err((StatusCode::BAD_REQUEST, format!("Database update rejected: {errs}")).into());
757+
if let Some(updated) = maybe_updated {
758+
match updated {
759+
UpdateDatabaseResult::AutoMigrateError(errs) => {
760+
return Err((StatusCode::BAD_REQUEST, format!("Database update rejected: {errs}")).into());
761+
}
762+
UpdateDatabaseResult::ErrorExecutingMigration(err) => {
763+
return Err((
764+
StatusCode::BAD_REQUEST,
765+
format!("Failed to create or update the database: {err}"),
766+
)
767+
.into());
768+
}
769+
UpdateDatabaseResult::NoUpdateNeeded | UpdateDatabaseResult::UpdatePerformed => {}
770+
}
759771
}
760772

761773
Ok(axum::Json(PublishResult::Success {

0 commit comments

Comments
 (0)