errors

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpCodeOfUnEnum = func(err error) (code int, desc string) {
	return 599, err.Error()
}

Functions

func As

func As(err error, target interface{}) bool

func Detail

func Detail(err error) string

func Err

func Err(err error) error

func HttpCodeOf

func HttpCodeOf(err error) (code int, desc string)

func Is

func Is(err, target error) bool

func New

func New(msg string) error

func Unwrap

func Unwrap(err error) error

Types

type Causer

type Causer interface {
	Cause() error
}

type ErrorInfo

type ErrorInfo struct {
	Err  error
	Why  error
	Cmd  []interface{}
	File string
	Line int
}

func Info

func Info(err error, cmd ...interface{}) *ErrorInfo

func InfoEx

func InfoEx(skip int, err error, cmd ...interface{}) *ErrorInfo

file and line tracing may have problems with go1.9, see related issue: https://github.com/golang/go/issues/22916

func (*ErrorInfo) Cause

func (r *ErrorInfo) Cause() error

func (*ErrorInfo) Detail

func (r *ErrorInfo) Detail(err error) *ErrorInfo

func (*ErrorInfo) Error

func (r *ErrorInfo) Error() string

func (*ErrorInfo) ErrorCode

func (r *ErrorInfo) ErrorCode() string

func (*ErrorInfo) ErrorDetail

func (r *ErrorInfo) ErrorDetail() string

func (*ErrorInfo) HttpCode

func (r *ErrorInfo) HttpCode() int

func (*ErrorInfo) Log

func (r *ErrorInfo) Log(level int, reqId string) *ErrorInfo

func (*ErrorInfo) LogError

func (r *ErrorInfo) LogError(reqId string) *ErrorInfo

func (*ErrorInfo) LogMessage

func (r *ErrorInfo) LogMessage() string

func (*ErrorInfo) LogWarn

func (r *ErrorInfo) LogWarn(reqId string) *ErrorInfo

func (*ErrorInfo) Method

func (r *ErrorInfo) Method() (cmd string, ok bool)

func (*ErrorInfo) Unwrap

func (r *ErrorInfo) Unwrap() error

func (*ErrorInfo) Warn

func (r *ErrorInfo) Warn() *ErrorInfo

deprecated. please use (*ErrorInfo).LogWarn

Jump to

Keyboard shortcuts

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