errors

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTeamNotExists     = NewError(errcode.Team_no_exists, "team not exists")
	ErrNoAuthority       = NewError(errcode.No_authority, "no authority")
	ErrTeamTransferError = NewError(errcode.Team_transfer_error, "team transfer error")
	ErrNotInTeam         = NewError(errcode.Not_in_team, "not in team")
	ErrInTeam            = NewError(errcode.In_team, "in team")
	ErrTeamMax           = NewError(errcode.Team_max, "team max")
	ErrAppliedToJoin     = NewError(errcode.Applied_to_join, "applied to join")
	ErrMongoNoDoc        = NewError(errcode.Not_found, "mongo: no documents in result")
	ErrMongoOp           = NewError(errcode.Mongo_op_error, "mongo op failed")
	ErrRedisOp           = NewError(errcode.Redis_op_error, "redis op failed")
	ErrHasTeam           = NewError(errcode.Target_has_team, "target has team")
	ErrNoExam            = NewError(errcode.Team_no_exam, "no exam id")
)

Functions

func As

func As(err error, target interface{}) bool

As Wrapping for errors.As standard library

func Is

func Is(err, target error) bool

Is Wrapping for errors.Is standard library

func New

func New(text string) error

New Wrapping for errors.New standard library

func Unwrap

func Unwrap(err error) error

Unwrap Wrapping for errors.Unwrap standard library

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

func New

func New(text string) *Error

New 新建一个错误 可传入一下参数: text : 文本字符串

func NewError

func NewError(args ...interface{}) *Error

NewError 新建一个错误 可传入一下参数: text : 文本字符串 code : 错误码 error: 原生错误

func (*Error) Code

func (e *Error) Code() int32

Code 返回错误码

func (*Error) Error added in v0.0.23

func (e *Error) Error() (text string)

func (*Error) ErrorWithArgs added in v0.0.23

func (e *Error) ErrorWithArgs(args ...interface{}) (text string)

func (*Error) Is

func (e *Error) Is(err error) bool

func (*Error) Next

func (e *Error) Next() error

Next 返回下一个错误

Jump to

Keyboard shortcuts

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