errorlib

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package errorlib 模块名: 调用者 功能描述: 用来描述调用者信息 作者: yr 2023/7/3 0003 16:44 最后更新: yr 2023/7/3 0003 16:44

Package errorlib 模块名: 错误码 功能描述: 用于错误传递,上层错误捕获可以看到这个错误最初是哪里来的 作者: yr 2023/6/7 0007 0:24 最后更新: yr 2023/6/7 0007 0:24

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineErr

func CombineErr(errs ...error) error

Types

type CError

type CError interface {
	error

	Is(int) bool
	GetCode() int
	GetMsg() string
}

func NewErrCode

func NewErrCode(code int, args ...interface{}) CError

NewErrCode 新建错误码

type ErrCode

type ErrCode struct {
	Code int    // 错误码(这个主要用来给一些地方做判断使用,避免直接判断字符串)
	Msg  string // 错误信息
	// contains filtered or unexported fields
}

ErrCode 错误码对象

func (*ErrCode) Error

func (e *ErrCode) Error() string

Error 返回错误信息

func (*ErrCode) GetCode

func (e *ErrCode) GetCode() int

GetCode 获取错误码

func (*ErrCode) GetMsg

func (e *ErrCode) GetMsg() string

GetMsg 获取错误信息

func (*ErrCode) Is

func (e *ErrCode) Is(code int) bool

Is 判断错误码是否是code

func (*ErrCode) String

func (e *ErrCode) String() string

String 当前错误对象的错误信息

Jump to

Keyboard shortcuts

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