errors

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: MPL-2.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(current error, next ...error) error

func Embed

func Embed(err error, data any) error

func GetEmbeddedData

func GetEmbeddedData[Data any](err error) (Data, bool)

func Is

func Is(err error, code ErrorCode) bool

func New

func New(err error, code ErrorCode, text string) error

func Newf

func Newf(err error, code ErrorCode, format string, args ...any) error

func Unwrap

func Unwrap(err error) error

func Wrap

func Wrap(err error, text string) error

func Wrapf

func Wrapf(err error, format string, args ...any) error

Types

type Codeable

type Codeable interface {
	error
	GetErrorCode() ErrorCode
}

type DataContainer

type DataContainer interface {
	error
	GetEmbeddedData() interface{}
}

type DataContainingError

type DataContainingError struct {
	*WrappingError
	// contains filtered or unexported fields
}

func (*DataContainingError) GetEmbeddedData

func (d *DataContainingError) GetEmbeddedData() interface{}

type ErrorCode

type ErrorCode string
const (
	ErrorCodeUnknown ErrorCode = "ErrorCodeUnknown"
	ErrorCodeOk      ErrorCode = "ErrorCodeOk"
	ErrorCodeWrapped ErrorCode = "ErrorCodeWrapped"
	ErrorCodeMulti   ErrorCode = "ErrorCodeMulti"
)

func GetErrorCode

func GetErrorCode(err error) ErrorCode

type Unwrappable

type Unwrappable interface {
	error
	Unwrap() error
}

type WrappingError

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

func (*WrappingError) Error

func (e *WrappingError) Error() string

func (*WrappingError) GetErrorCode

func (e *WrappingError) GetErrorCode() ErrorCode

func (*WrappingError) Unwrap

func (e *WrappingError) Unwrap() error

Jump to

Keyboard shortcuts

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