Documentation
¶
Index ¶
- Variables
- func New400Response(msg string) error
- func New500Response(msg string) error
- func NewResponse(code int, msg string, status ...int) error
- func Wrap400Response(err error, msg ...string) error
- func Wrap500Response(err error, msg ...string) error
- func WrapResponse(err error, code int, msg string, status ...int) error
- type ResponseError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( New = errors.New Wrap = errors.Wrap Wrapf = errors.Wrapf WithStack = errors.WithStack WithMessage = errors.WithMessage WithMessagef = errors.WithMessagef )
定义别名
View Source
var ( ErrBadRequest = New400Response("请求错误") ErrInternal = New500Response("系统内部错误") ErrorMethodNotAllow = NewResponse(405, "该请求方法不被允许") ErrorTooManyRequests = NewResponse(200, "请求过于频繁") ErrNotFound = NewResponse(404, "资源不存在", 404) )
Functions ¶
func New400Response ¶
func New500Response ¶
func Wrap400Response ¶
func Wrap500Response ¶
Types ¶
type ResponseError ¶
func UnWrapResponse ¶
func UnWrapResponse(err error) *ResponseError
func (*ResponseError) Error ¶
func (r *ResponseError) Error() string
Click to show internal directories.
Click to hide internal directories.