errorz

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(err error, substr string) bool

func Errorf added in v0.0.57

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

Errorf is a function like xerrors.Errorf.

func FormatError added in v0.0.57

func FormatError(s fmt.State, verb rune, err error)

FormatError is intended to be used as follows:

func (e *customError) Format(s fmt.State, verb rune) {
	errorz.FormatError(s, verb, e.Unwrap())
}

func HasPrefix added in v0.0.57

func HasPrefix(err error, prefix string) bool

func HasSuffix added in v0.0.57

func HasSuffix(err error, suffix string) bool

func IsNetTimeout added in v0.0.62

func IsNetTimeout(err error) bool

func IsRetryable added in v0.0.57

func IsRetryable(err error) bool

func NewErrorf added in v0.0.57

func NewErrorf(opts ...ErrorfOption) func(format string, a ...interface{}) error

NewErrorf returns a function like xerrors.Errorf. It is possible to return a function with different behaviors by passing ErrorfOption as arguments.

func PanicOrIgnore added in v0.0.60

func PanicOrIgnore(err error, ignores ...error)

func WithRetryable added in v0.0.57

func WithRetryable(err error, retryable bool) error

Types

type ErrorfOption added in v0.0.57

type ErrorfOption interface {
	// contains filtered or unexported methods
}

func WithCallerSkip added in v0.0.57

func WithCallerSkip(callerSkip int) ErrorfOption

WithCallerSkip returns an ErrorfOption that sets the number of stack frames to skip.

Jump to

Keyboard shortcuts

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