errno

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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 New203Errno(businessCode int, err error) *Errno

func New400Errno

func New400Errno(businessCode int, err error) *Errno

func New401Errno

func New401Errno(businessCode int, err error) *Errno

func New403Errno

func New403Errno(businessCode int, err error) *Errno

func New404Errno

func New404Errno(businessCode int, err error) *Errno

func New429Errno

func New429Errno(businessCode int, err error) *Errno

func New500Errno

func New500Errno(businessCode int, err error) *Errno

func NewBaseErrno

func NewBaseErrno(httpCode int, businessCode int, err error) *Errno

func NewBusinessErrno

func NewBusinessErrno(businessCode int, err error) *Errno

NewBusinessError 业务错误 http code 203 表示业务错误, http code 401 表示请求错误

func NewErrno

func NewErrno(httpCode, businessCode int, msg string) *Errno

func WrapMySQLExecErrno

func WrapMySQLExecErrno(err error) *Errno

WrapMySQLExecError SQL创建, 更新, 删除 执行错误. 查询错误不要用这个. 唯一索引和主键冲突, 一般是业务问题, 也不要用这个.

func WrapParamBindErrno

func WrapParamBindErrno(err error) *Errno

WrapParamBindError 请求参数绑定到go对象错误. 请求参数序列化错误.

func (*Errno) Error

func (e *Errno) Error() string

func (*Errno) GetBusinessCode

func (e *Errno) GetBusinessCode() int

func (*Errno) GetErr

func (e *Errno) GetErr() error

func (*Errno) GetHttpCode

func (e *Errno) GetHttpCode() int

func (*Errno) GetMsg

func (e *Errno) GetMsg() string

func (*Errno) ToString

func (e *Errno) ToString() string

ToString 返回 JSON 格式的错误详情

func (*Errno) WithErr

func (e *Errno) WithErr(err error) *Errno

type Error

type Error interface {
	error
}

func Cause

func Cause(err error) Error

func Errorf

func Errorf(format string, args ...interface{}) Error

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

func NewError(message string) Error

New returns an error with the supplied message. New also records the stack trace at the point it was called.

func Unwrap

func Unwrap(err error) Error

func WithStack

func WithStack(err error) Error

WithStack annotates err with a stack trace at the point WithStack was called. If err is nil, WithStack returns nil.

func Wrap

func Wrap(err error, message string) Error

Wrap returns an error annotating err with a stack trace at the point Wrap is called, and the supplied message. If err is nil, Wrap returns nil.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) Error

Wrapf returns an error annotating err with a stack trace at the point Wrapf is called, and the format specifier. If err is nil, Wrapf returns nil.

Jump to

Keyboard shortcuts

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