errors

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCode

func GetCode(err error) int

获取错误码

func GetErr

func GetErr(err error) error

获取原始错误信息

func GetMsg

func GetMsg(err error) string

获取错误信息

func SetDebug

func SetDebug(debug bool)

设置是否输出错误码与原始错误信息

Types

type Error

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

func GetErrors

func GetErrors(err error) *Error

判断是否为自定义错误 并返回自定义错误

func New

func New(msg string, rawErr ...error) *Error

创建错误 msg 为错误信息 rawErr 为原始错误信息

func NewErrorf

func NewErrorf(rawErr error, msgFormat string, args ...interface{}) *Error

创建错误 rawErr 为原始错误信息 msgFormat 为格式化错误信息 args 为格式化参数

func NewErrorfWithCode

func NewErrorfWithCode(code int, rawErr error, msgFormat string, args ...interface{}) *Error

创建错误 code 为错误码 rawErr 为原始错误信息 msgFormat 为格式化错误信息 args 为格式化参数

func NewWithCode

func NewWithCode(code int, msg string, rawErr error) *Error

创建错误 code 为错误码 msg 为错误信息 rawErr 为原始错误信息

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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