Standardize service errors with ProblemDetails envelope
This commit is contained in:
@@ -66,7 +66,7 @@ public static class StateEndpoints
|
||||
{
|
||||
if (reconciled)
|
||||
await db.SaveChangesAsync();
|
||||
return Results.BadRequest(new { error = "Results are locked until the admin enables them." });
|
||||
return EndpointHelpers.BadRequestError("Results are locked until the admin enables them.");
|
||||
}
|
||||
|
||||
player.CurrentPhase = next;
|
||||
@@ -88,7 +88,7 @@ public static class StateEndpoints
|
||||
var isAdmin = await EndpointHelpers.IsAdmin(ctx, db);
|
||||
if (!isAdmin)
|
||||
{
|
||||
return Results.BadRequest(new { error = "Only admins can move backward." });
|
||||
return EndpointHelpers.BadRequestError("Only admins can move backward.");
|
||||
}
|
||||
|
||||
var appState = await db.AppState.FirstAsync();
|
||||
|
||||
Reference in New Issue
Block a user