mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
fix: remove string TTL from workspace error responses (#3257)
- Rewrites some error messages to better integrate with the frontend (ttl_ms -> time until shutdown) - Makes codersdk.ValidationError implement the error interface - Only return validations if the error was a validation error, return detail otherwise (e.g. database error)
This commit is contained in:
@ -192,7 +192,7 @@ func (c *Client) UpdateWorkspaceTTL(ctx context.Context, id uuid.UUID, req Updat
|
||||
path := fmt.Sprintf("/api/v2/workspaces/%s/ttl", id.String())
|
||||
res, err := c.Request(ctx, http.MethodPut, path, req)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("update workspace ttl: %w", err)
|
||||
return xerrors.Errorf("update workspace time until shutdown: %w", err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
@ -212,7 +212,7 @@ func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutEx
|
||||
path := fmt.Sprintf("/api/v2/workspaces/%s/extend", id.String())
|
||||
res, err := c.Request(ctx, http.MethodPut, path, req)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("extend workspace ttl: %w", err)
|
||||
return xerrors.Errorf("extend workspace time until shutdown: %w", err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusNotModified {
|
||||
|
Reference in New Issue
Block a user