mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: Linter rule for properly formatted api errors (#2123)
* chore: Linter rule for properly formatted api errors * Add omitempty to 'Detail' field
This commit is contained in:
@ -24,7 +24,7 @@ func parsePagination(w http.ResponseWriter, r *http.Request) (p codersdk.Paginat
|
||||
afterID, err = uuid.Parse(r.URL.Query().Get("after_id"))
|
||||
if err != nil {
|
||||
httpapi.Write(w, http.StatusBadRequest, httpapi.Response{
|
||||
Message: "Query param 'after_id' must be a valid UUID",
|
||||
Message: "Query param 'after_id' must be a valid UUID.",
|
||||
Validations: []httpapi.Error{
|
||||
{Field: "after_id", Detail: err.Error()},
|
||||
},
|
||||
@ -36,7 +36,7 @@ func parsePagination(w http.ResponseWriter, r *http.Request) (p codersdk.Paginat
|
||||
limit, err = strconv.Atoi(s)
|
||||
if err != nil {
|
||||
httpapi.Write(w, http.StatusBadRequest, httpapi.Response{
|
||||
Message: "Query param 'limit' must be a valid integer",
|
||||
Message: "Query param 'limit' must be a valid integer.",
|
||||
Validations: []httpapi.Error{
|
||||
{Field: "limit", Detail: err.Error()},
|
||||
},
|
||||
@ -48,7 +48,7 @@ func parsePagination(w http.ResponseWriter, r *http.Request) (p codersdk.Paginat
|
||||
offset, err = strconv.Atoi(s)
|
||||
if err != nil {
|
||||
httpapi.Write(w, http.StatusBadRequest, httpapi.Response{
|
||||
Message: "Query param 'offset' must be a valid integer",
|
||||
Message: "Query param 'offset' must be a valid integer.",
|
||||
Validations: []httpapi.Error{
|
||||
{Field: "offset", Detail: err.Error()},
|
||||
},
|
||||
|
Reference in New Issue
Block a user