errors

package
v0.0.0-...-3c59bae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

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 New400Response(msg string) error

func New500Response

func New500Response(msg string) error

func NewResponse

func NewResponse(code int, msg string, status ...int) error

func Wrap400Response

func Wrap400Response(err error, msg ...string) error

func Wrap500Response

func Wrap500Response(err error, msg ...string) error

func WrapResponse

func WrapResponse(err error, code int, msg string, status ...int) error

Types

type ResponseError

type ResponseError struct {
	Code       int
	Message    string
	StatusCode int
	ERR        error
}

func UnWrapResponse

func UnWrapResponse(err error) *ResponseError

func (*ResponseError) Error

func (r *ResponseError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL