Skip to content

Commit

Permalink
feat(kuma-cp): map BadRequest error to 400 (#8312)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <[email protected]>
  • Loading branch information
lukidzi authored Nov 13, 2023
1 parent f806219 commit 07fcbed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/core/rest/errors/error_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func HandleError(ctx context.Context, response *restful.Response, err error, tit
Title: title,
Detail: "Not found",
}
case errors.Is(err, &rest.InvalidResourceError{}) || errors.Is(err, &registry.InvalidResourceTypeError{}) || errors.Is(err, &store.PreconditionError{}):
case errors.Is(err, &rest.InvalidResourceError{}), errors.Is(err, &registry.InvalidResourceTypeError{}), errors.Is(err, &store.PreconditionError{}), errors.Is(err, &BadRequest{}):
kumaErr = &types.Error{
Status: 400,
Title: "Bad Request",
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/rest/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewBadRequestError(msg string) error {
}

func (e *BadRequest) Error() string {
if e.msg != "" {
if e.msg == "" {
return "bad request"
}
return fmt.Sprintf("bad request: %s", e.msg)
Expand Down

0 comments on commit 07fcbed

Please sign in to comment.