Skip to content

Commit edcc5dd

Browse files
committed
fixup! fix: remove string TTL from workspace error responses
1 parent 4311586 commit edcc5dd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

coderd/workspaces.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -547,19 +547,18 @@ func (api *API) putWorkspaceTTL(rw http.ResponseWriter, r *http.Request) {
547547
})
548548

549549
if err != nil {
550+
resp := codersdk.Response{
551+
Message: "Error updating workspace time until shutdown.",
552+
}
550553
var validErr codersdk.ValidationError
551554
if errors.As(err, &validErr) {
552-
httpapi.Write(rw, http.StatusBadRequest, codersdk.Response{
553-
Message: "Error updating workspace time until shutdown!",
554-
Validations: []codersdk.ValidationError{validErr},
555-
})
555+
resp.Validations = []codersdk.ValidationError{validErr}
556+
httpapi.Write(rw, http.StatusBadRequest, resp)
556557
return
557558
}
558559

559-
httpapi.Write(rw, http.StatusInternalServerError, codersdk.Response{
560-
Message: "Error updating workspace time until shutdown!",
561-
Detail: err.Error(),
562-
})
560+
resp.Detail = err.Error()
561+
httpapi.Write(rw, http.StatusInternalServerError, resp)
563562
return
564563
}
565564

0 commit comments

Comments
 (0)