Skip to content

Commit

Permalink
add errorx builder
Browse files Browse the repository at this point in the history
  • Loading branch information
waltcow committed Oct 28, 2022
1 parent 932b7a0 commit 7917376
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/errorx/apierror.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,15 @@ func NewApiError(code int, msg string) error {
func NewApiErrorWithoutMsg(code int) error {
return &ApiError{Code: code, Msg: ""}
}

func NewApiBadRequestError(msg string) error {
return NewApiError(400, msg)
}

func NewApiNotFoundError(msg string) error {
return NewApiError(404, msg)
}

func NewApiInternalServerError(msg string) error {
return NewApiError(500, msg)
}

0 comments on commit 7917376

Please sign in to comment.