chaoserrors

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

错误码

Documentation

Overview

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

Package chaoserrors 模块名: 模块名 功能描述: 描述 作者: yr 2023/7/23 0023 13:12 最后更新: yr 2023/7/23 0023 13:12

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

Index

Constants

View Source
const (
	Success   = 0 // 成功
	IsRunning = 1 // 运行中
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CError added in v1.0.1

type CError interface {
	error
	GetErrCode() int
	EqualErrCode(int) bool
	GetCode() int
	GetMsg() string
}

func NewErrCode

func NewErrCode(code int, msg string, preMsg error) CError

NewErrCode 新建错误码

type ErrCode

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

ErrCode 错误码对象

func (*ErrCode) EqualErrCode

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

EqualErrCode 比较错误码

func (*ErrCode) Error

func (e *ErrCode) Error() string

Error 返回错误信息

func (*ErrCode) GetCode added in v1.0.1

func (e *ErrCode) GetCode() int

GetCode 获取错误码

func (*ErrCode) GetErrCode added in v1.0.1

func (e *ErrCode) GetErrCode() int

func (*ErrCode) GetMsg added in v1.0.5

func (e *ErrCode) GetMsg() string

GetMsg 获取错误信息

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