errors

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New added in v1.2.0

func New(text string) error

兼容 errors.New 原生函数

Types

type APIError

type APIError struct {
	Code constant.APICodeType
	Msg  string
	Data any
	// contains filtered or unexported fields
}

func NewAPIError

func NewAPIError(msg string, codeOpt ...constant.APICodeType) (ae *APIError)

NewAPIError 创建常规的 APIError,code 默认:API_ERROR

func NewAPIErrorWrap

func NewAPIErrorWrap(err error) (ae *APIError)

NewAPIErrorWrap 创建包装过原始错误信息的 APIError,并提供 stack ,code 默认:API_CRASH

func (*APIError) Error

func (ae *APIError) Error() string

Error 实现 errors 接口

func (*APIError) Unwrap

func (ae *APIError) Unwrap() error

Unwrap 实现 errors 接口

func (*APIError) UnwrapError added in v1.3.2

func (ae *APIError) UnwrapError() string

UnwrapError 输出所有包装层的错误信息

Jump to

Keyboard shortcuts

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