xerrors

package
v1.12.22 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

* 自定义错误类型,一般用在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 ErrorString

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

func MakeError

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

MakeError 创建一个error

func (*ErrorString) Code

func (e *ErrorString) Code() int

Code 返回code

func (*ErrorString) Error

func (e *ErrorString) Error() string

Error 实现了error interface{} Error方法

func (*ErrorString) Stack

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

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

Jump to

Keyboard shortcuts

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