Documentation ¶
Index ¶
- type Errno
- func New203Errno(businessCode int, err error) *Errno
- func New400Errno(businessCode int, err error) *Errno
- func New401Errno(businessCode int, err error) *Errno
- func New403Errno(businessCode int, err error) *Errno
- func New404Errno(businessCode int, err error) *Errno
- func New429Errno(businessCode int, err error) *Errno
- func New500Errno(businessCode int, err error) *Errno
- func NewBaseErrno(httpCode int, businessCode int, err error) *Errno
- func NewBusinessErrno(businessCode int, err error) *Errno
- func NewErrno(httpCode, businessCode int, msg string) *Errno
- func WrapMySQLExecErrno(err error) *Errno
- func WrapParamBindErrno(err error) *Errno
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Errno ¶
type Errno struct { HttpCode int `json:"http_code"` // HTTP Code BusinessCode int `json:"business_code"` // Business Code Message string `json:"message"` // 描述信息 // contains filtered or unexported fields }
func New203Errno ¶
func New400Errno ¶
func New401Errno ¶
func New403Errno ¶
func New404Errno ¶
func New429Errno ¶
func New500Errno ¶
func NewBusinessErrno ¶
NewBusinessError 业务错误 http code 203 表示业务错误, http code 401 表示请求错误
func WrapMySQLExecErrno ¶
WrapMySQLExecError SQL创建, 更新, 删除 执行错误. 查询错误不要用这个. 唯一索引和主键冲突, 一般是业务问题, 也不要用这个.
func WrapParamBindErrno ¶
WrapParamBindError 请求参数绑定到go对象错误. 请求参数序列化错误.
func (*Errno) GetBusinessCode ¶
func (*Errno) GetHttpCode ¶
type Error ¶
type Error interface { error }
func Errorf ¶
Errorf formats according to a format specifier and returns the string as a value that satisfies error. Errorf also records the stack trace at the point it was called.
func NewError ¶
New returns an error with the supplied message. New also records the stack trace at the point it was called.
func WithStack ¶
WithStack annotates err with a stack trace at the point WithStack was called. If err is nil, WithStack returns nil.
Click to show internal directories.
Click to hide internal directories.