Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions internal/cmdutil/json_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func GlobalJSONError(err error) JSONErrorResponse {
// exists; retry the follow-up command once the snapshot finishes.
case strings.Contains(lower, "schema refreshing"):
status = "action_required"
code = "schema_snapshot_not_ready"
code = "schema_refreshing"
nextSteps = []string{
"Wait for the branch schema snapshot to become ready, then retry",
}
Expand All @@ -202,7 +202,7 @@ func GlobalJSONError(err error) JSONErrorResponse {
nextSteps = []string{
"Wait for the active vtctld mutation or deploy to finish, then retry",
}
case "schema_snapshot_not_ready":
case "schema_refreshing", "schema_snapshot_not_ready":
status = "action_required"
nextSteps = []string{
"Wait for the branch schema snapshot to become ready, then retry",
Expand Down
18 changes: 17 additions & 1 deletion internal/cmdutil/json_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,23 @@ func TestGlobalJSONErrorSchemaRefreshing(t *testing.T) {
if resp.Status != "action_required" {
t.Fatalf("status = %q", resp.Status)
}
if resp.Code() != "schema_snapshot_not_ready" {
if resp.Code() != "schema_refreshing" {
t.Fatalf("code = %q", resp.Code())
}
if len(resp.NextSteps) != 1 || resp.NextSteps[0] != "Wait for the branch schema snapshot to become ready, then retry" {
t.Fatalf("next_steps = %#v", resp.NextSteps)
}
}

func TestGlobalJSONErrorSchemaRefreshingAPICode(t *testing.T) {
resp := GlobalJSONError(&planetscale.Error{
APICode: "schema_refreshing",
})

if resp.Status != "action_required" {
t.Fatalf("status = %q", resp.Status)
}
if resp.Code() != "schema_refreshing" {
t.Fatalf("code = %q", resp.Code())
}
if len(resp.NextSteps) != 1 || resp.NextSteps[0] != "Wait for the branch schema snapshot to become ready, then retry" {
Expand Down
Loading