You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package nstatus
|
|
|
|
|
|
|
|
|
|
import "git.noahlan.cn/noahlan/ntool-biz/core/nstatus/code"
|
|
|
|
|
|
|
|
|
|
// NewApiErr 构建Api错误,code为http状态码
|
|
|
|
|
func NewApiErr(code int, message string) error {
|
|
|
|
|
return NewResult(code, message, ApiErr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewApiErrNoMsg 构建Api错误,空错误消息
|
|
|
|
|
func NewApiErrNoMsg(code int) error {
|
|
|
|
|
return NewApiErr(code, "")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewApiInternalErr(msg string) error {
|
|
|
|
|
return NewApiErr(code.StatusInternalServerError, msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewApiBadRequestErr(msg string) error {
|
|
|
|
|
return NewApiErr(code.StatusBadRequest, msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewApiUnauthorizedErr(msg string) error {
|
|
|
|
|
return NewApiErr(code.StatusUnauthorized, msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewApiForbiddenErr(msg string) error {
|
|
|
|
|
return NewApiErr(code.StatusForbidden, msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewApiNotFoundErr(msg string) error {
|
|
|
|
|
return NewApiErr(code.StatusNotFound, msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewApiBadGatewayErr(msg string) error {
|
|
|
|
|
return NewApiErr(code.StatusBadGateway, msg)
|
|
|
|
|
}
|