errors

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

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

As alias of errors.As

func Cause

func Cause(err error) error

Cause returns the cause of this error

func Detail

func Detail(err error) string

Detail returns detail of error, add prefix sign at the first

func Is

func Is(err, target error) bool

Is alias of errors.Is

func New

func New(msg string) error

New alias of errors.New

func Newf

func Newf(format string, a ...interface{}) error

Newf alias of fmt.Errorf

func Newx

func Newx(v ...interface{}) error

Newx returns error with multi message

func Unwrap

func Unwrap(err error) error

Unwrap alias of errors.Unwrap

Types

type Error

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

Error error with detail

func Base

func Base(err error, cmd ...interface{}) *Error

Base returns a runtime.Caller(1) detail error based the error

func BaseEx

func BaseEx(skip int, err error, cmd ...interface{}) *Error

BaseEx returns a runtime.Caller(skip) detail error based the error. file and line tracing may have problems with go1.9, see related issue: https://github.com/golang/go/issues/22916

func Info

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

Info alias of Base, deprecated

func InfoEx

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

InfoEx alias of BaseEx, deprecated

func (*Error) Cause

func (r *Error) Cause() error

Cause returns the cause of this error

func (*Error) Detail

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

Detail returns Error with why

func (*Error) Details

func (r *Error) Details() string

Details returns detail message of the error

func (*Error) Error

func (r *Error) Error() string

Error returns base error Error()

func (*Error) Unwrap

func (r *Error) Unwrap() error

Unwrap returns why of the error

Jump to

Keyboard shortcuts

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