errors

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: BSD-2-Clause Imports: 6 Imported by: 51

README

Errors

This repo contains error helpers.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContextDataToError added in v1.1.0

func AddContextDataToError(ctx context.Context, err error) error

func AddToContext added in v1.1.0

func AddToContext(ctx context.Context, key, value string) context.Context

func As added in v1.2.0

func As(err error, target any) bool

func Cause added in v1.1.0

func Cause(err error) error

func DataFromContext added in v1.1.0

func DataFromContext(ctx context.Context) map[string]string

func DataFromError added in v1.1.0

func DataFromError(err error) map[string]string

func Errorf added in v1.1.0

func Errorf(ctx context.Context, format string, args ...interface{}) error

func Is added in v1.1.1

func Is(err, target error) bool

func Join

func Join(errs ...error) error

func New added in v1.1.0

func New(ctx context.Context, message string) error

func Unwrap

func Unwrap(err error) error

func Wrap added in v1.1.0

func Wrap(ctx context.Context, err error, message string) error

func Wrapf added in v1.1.0

func Wrapf(ctx context.Context, err error, format string, args ...interface{}) error

Types

type DataError added in v1.1.0

type DataError interface {
	error
	HasData
	HasCause
}

func AddDataToError added in v1.1.0

func AddDataToError(err error, data map[string]string) DataError

type ErrorList added in v1.1.0

type ErrorList interface {
	Add(err error)
	Len() int
	AsStringArray() []string
}

func NewErrorList added in v1.1.0

func NewErrorList() ErrorList

type HasCause added in v1.1.0

type HasCause interface {
	Cause() error
}

type HasData added in v1.1.0

type HasData interface {
	Data() map[string]string
}

Jump to

Keyboard shortcuts

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