chore: Update BE http errors to be ui friendly (#1994)

* chore: More UI friendly errors

Mainly capitlization + messages prefix error
This commit is contained in:
Steven Masley
2022-06-03 21:48:09 +00:00
committed by GitHub
parent 847e2b18da
commit c9a4642a12
42 changed files with 544 additions and 317 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
package coderd
import (
"fmt"
"net/http"
"github.com/coder/coder/coderd/httpmw"
@@ -60,7 +61,7 @@ func (api *API) checkPermissions(rw http.ResponseWriter, r *http.Request) {
for k, v := range params.Checks {
if v.Object.ResourceType == "" {
httpapi.Write(rw, http.StatusBadRequest, httpapi.Response{
Message: "'resource_type' must be defined",
Message: fmt.Sprintf("Object's \"resource_type\" field must be defined for key %q", k),
})
return
}