xerrors

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 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

Types

type ErrorString

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

func MakeError

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

func (*ErrorString) Error

func (e *ErrorString) Error() string

实现了error interface{} Error方法

func (*ErrorString) Stack

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

打印完整的错误堆栈信息

Jump to

Keyboard shortcuts

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