failure

package
v0.0.0-...-5c12a10 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BacktraceCleaner = &backtraceCleaner{}
)
View Source
var (
	CaptureBacktraceSize = 5
)

Functions

func As

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

func GetErrorCode

func GetErrorCode(err error) string

func GetErrorCodes

func GetErrorCodes(err error) []string

func Is

func Is(err, target error) bool

func IsCode

func IsCode(err error, code Code) bool

func NewError

func NewError(code Code, err error) error

func SkipGOROOT

func SkipGOROOT(b Backtrace) bool

Types

type Backtrace

type Backtrace struct {
	Function string
	File     string
	LineNo   int
}

func (*Backtrace) String

func (b *Backtrace) String() string

type Code

type Code interface {
	Error() string
	ErrorCode() string
}

type Error

type Error struct {
	Code
	// contains filtered or unexported fields
}

func (*Error) Format

func (e *Error) Format(f fmt.State, c rune)

func (*Error) FormatError

func (e *Error) FormatError(p xerrors.Printer) error

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Errors

type Errors struct {
	// contains filtered or unexported fields
}

func NewErrors

func NewErrors(ctx context.Context) *Errors

func (*Errors) Add

func (s *Errors) Add(err error)

func (*Errors) All

func (s *Errors) All() []error

func (*Errors) Close

func (s *Errors) Close()

func (*Errors) Count

func (s *Errors) Count() map[string]int64

func (*Errors) Done

func (s *Errors) Done()

func (*Errors) Hook

func (s *Errors) Hook(hook ErrorsHook)

func (*Errors) Messages

func (s *Errors) Messages() map[string][]string

func (*Errors) Reset

func (s *Errors) Reset()

func (*Errors) Wait

func (s *Errors) Wait()

type ErrorsHook

type ErrorsHook func(error)

type StringCode

type StringCode string
const (
	UnknownErrorCode   StringCode = "unknown"
	CanceledErrorCode  StringCode = "canceled"
	TimeoutErrorCode   StringCode = "timeout"
	TemporaryErrorCode StringCode = "temporary"
)

func (StringCode) Error

func (s StringCode) Error() string

func (StringCode) ErrorCode

func (s StringCode) ErrorCode() string

Jump to

Keyboard shortcuts

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