xerrors

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

*Package xerrors 自定义错误类型,一般用在api/微服务等业务逻辑中,处理错误 支持是否输出堆栈信息,可以把stack信息记录到日志文件中,方便定位问题

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(text string, code int, isStack ...bool) error

New 创建一个error

Types

type ErrImpl added in v1.5.0

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

ErrImpl impl error interface

func MakeError

func MakeError(text string, code int, isStack bool) *ErrImpl

MakeError 创建一个error

func (*ErrImpl) Code added in v1.5.0

func (e *ErrImpl) Code() int

Code 返回code

func (*ErrImpl) Error added in v1.5.0

func (e *ErrImpl) Error() string

Error 实现了error interface{} Error方法

func (*ErrImpl) Stack added in v1.5.0

func (e *ErrImpl) Stack() []byte

Stack 打印完整的错误堆栈信息

Jump to

Keyboard shortcuts

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