Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac80426

Browse files
committed
adjust error message
1 parent c46e8f2 commit ac80426

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

coderd/workspaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ func (api *API) putExtendWorkspace(rw http.ResponseWriter, r *http.Request) {
638638
// Normally, we would put the validation error in Validations, but this endpoint is
639639
// not tied to a form or specific named user input on the FE.
640640
code = http.StatusBadRequest
641-
resp.Message = err.Error()
641+
resp.Message = "Cannot extend workspace: " + err.Error()
642642
return err
643643
}
644644

coderd/workspaces_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,15 +1063,15 @@ func TestWorkspaceExtend(t *testing.T) {
10631063
err = client.PutExtendWorkspace(ctx, workspace.ID, codersdk.PutExtendWorkspaceRequest{
10641064
Deadline: deadlineTooSoon,
10651065
})
1066-
require.ErrorContains(t, err, "unexpected status code 400: new deadline must be at least 30 minutes in the future", "setting a deadline less than 30 minutes in the future should fail")
1066+
require.ErrorContains(t, err, "unexpected status code 400: Cannot extend workspace: new deadline must be at least 30 minutes in the future", "setting a deadline less than 30 minutes in the future should fail")
10671067

10681068
// And with a deadline greater than the template max_ttl should also fail
10691069
deadlineExceedsMaxTTL := time.Now().Add(time.Duration(template.MaxTTLMillis) * time.Millisecond).Add(time.Minute)
10701070
err = client.PutExtendWorkspace(ctx, workspace.ID, codersdk.PutExtendWorkspaceRequest{
10711071
Deadline: deadlineExceedsMaxTTL,
10721072
})
10731073

1074-
require.ErrorContains(t, err, "unexpected status code 400: new deadline is greater than template allows", "setting a deadline greater than that allowed by the template should fail")
1074+
require.ErrorContains(t, err, "unexpected status code 400: Cannot extend workspace: new deadline is greater than template allows", "setting a deadline greater than that allowed by the template should fail")
10751075

10761076
// Updating with a deadline 30 minutes in the future should succeed
10771077
deadlineJustSoonEnough := time.Now().Add(30 * time.Minute)

0 commit comments

Comments
 (0)