Skip to content

Commit

Permalink
Adjust error messages as per discussion in #557
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyandrewmeyer committed Jan 16, 2025
1 parent 85021c2 commit c0d483e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internals/daemon/api_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func v1PostChange(c *Command, r *http.Request, _ *UserState) Response {
}

if reqData.Action != "abort" {
return BadRequest("change action %q is unsupported", reqData.Action)
return BadRequest("invalid action %q", reqData.Action)
}

if chg.Status().Ready() {
Expand Down
4 changes: 2 additions & 2 deletions internals/daemon/api_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func v1PostChecks(c *Command, r *http.Request, _ *UserState) Response {
}
default:
if len(payload.Checks) == 0 {
return BadRequest("no checks to %s provided", payload.Action)
return BadRequest("must specify checks for %s action", payload.Action)
}
}

Expand All @@ -104,7 +104,7 @@ func v1PostChecks(c *Command, r *http.Request, _ *UserState) Response {
case "stop":
checks, err = checkmgr.StopChecks(plan, payload.Checks)
default:
return BadRequest("action %q is unsupported", payload.Action)
return BadRequest("invalid action %q", payload.Action)
}
if err != nil {
return BadRequest("cannot %s checks: %v", payload.Action, err)
Expand Down
4 changes: 2 additions & 2 deletions internals/daemon/api_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func v1PostServices(c *Command, r *http.Request, _ *UserState) Response {
payload.Services = services
default:
if len(payload.Services) == 0 {
return BadRequest("no services to %s provided", payload.Action)
return BadRequest("must specify services for %s action", payload.Action)
}
}

Expand Down Expand Up @@ -182,7 +182,7 @@ func v1PostServices(c *Command, r *http.Request, _ *UserState) Response {
sort.Strings(services)
payload.Services = services
default:
return BadRequest("action %q is unsupported", payload.Action)
return BadRequest("invalid action %q", payload.Action)
}
if err != nil {
return BadRequest("cannot %s services: %v", payload.Action, err)
Expand Down

0 comments on commit c0d483e

Please sign in to comment.