Skip to content

Commit

Permalink
feat(api): This commit is to implement bad request error
Browse files Browse the repository at this point in the history
  • Loading branch information
nia committed Oct 19, 2023
1 parent 0c86846 commit 1085a64
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/services/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ func NewErrUnathorized(err error, next error) error {
return errors.Wrap(err, next)
}

// NewErrBadRequest returns a error to be used when the access to a resource is not authorized.
func NewErrRequest(err error, next error) error {
return errors.Wrap(err, next)
}

// NewErrForbidden return a error to be used when the access to a resource is forbidden.
func NewErrForbidden(err error, next error) error {
return errors.Wrap(err, next)
Expand Down Expand Up @@ -378,6 +383,11 @@ func NewErrAuthUnathorized(err error) error {
return NewErrUnathorized(ErrAuthUnathorized, err)
}

// NewErrBadRequest returns a error to be used when the auth is unauthorized.
func NewErrBadRequest(err error) error {
return NewErrRequest(ErrBadRequest, err)
}

// NewErrNamespaceLimitReached a error to be used when the user namespace limit number is reached.
func NewErrNamespaceLimitReached(limit int, err error) error {
return NewErrLimit(ErrNamespaceLimitReached, limit, err)
Expand Down

0 comments on commit 1085a64

Please sign in to comment.