errors

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Overview

//nolint: errorlint // this is the new As method, also handling error lists

Index

Constants

View Source
const (
	KIND_FUNCTION      = "function"
	KIND_SCHEMAVERSION = "schema version"
	KIND_COMPONENT     = "component"
	KIND_ACCESSMETHOD  = "access method"
	KIND_OBJECTTYPE    = "object type"
)

Variables

View Source
var (
	New    = errors.New
	Unwrap = errors.Unwrap
)

Functions

func As

func As(err error, target any) bool

func ErrAlreadyExists

func ErrAlreadyExists(spec ...string) error

func ErrAlreadyExistsWrap

func ErrAlreadyExistsWrap(err error, spec ...string) error

func ErrClosed

func ErrClosed(spec ...string) error

func ErrInvalid

func ErrInvalid(spec ...string) error

func ErrInvalidType added in v0.7.0

func ErrInvalidType(kind string, v interface{}) error

ErrInvalidType reports an invalid or unexpected Go type for a dedicated purpose.

func ErrInvalidWrap

func ErrInvalidWrap(err error, spec ...string) error

func ErrNoMatch added in v0.7.0

func ErrNoMatch(spec ...string) error

func ErrNoMatchWrap added in v0.7.0

func ErrNoMatchWrap(err error, spec ...string) error

func ErrNotFound

func ErrNotFound(spec ...string) error

func ErrNotFoundWrap

func ErrNotFoundWrap(err error, spec ...string) error

func ErrNotImplemented

func ErrNotImplemented(spec ...string) error

func ErrNotSupported

func ErrNotSupported(spec ...string) error

func ErrReadOnly

func ErrReadOnly(spec ...string) error

func ErrRecusion

func ErrRecusion(kind string, elem interface{}, hist interface{}) error

ErrRecusion describes a resursion errors caused by a dedicated element with an element history.

func ErrRecusionWrap

func ErrRecusionWrap(err error, kind string, elem interface{}, hist interface{}) error

func ErrRequired added in v0.5.0

func ErrRequired(spec ...string) error

func ErrRequiredWrap added in v0.5.0

func ErrRequiredWrap(err error, spec ...string) error

func ErrStillInUse added in v0.3.0

func ErrStillInUse(spec ...string) error

func ErrStillInUseWrap added in v0.3.0

func ErrStillInUseWrap(err error, spec ...string) error

func ErrUnknown

func ErrUnknown(spec ...string) error

func Is

func Is(err error, target error) bool

Is checks for a concrete error object along the error chain.

func IsA

func IsA(err error, target error) bool

IsA checks for an error of a dedicated type along the error chain.

func IsErrAlreadyExists

func IsErrAlreadyExists(err error) bool

func IsErrAlreadyExistsKind

func IsErrAlreadyExistsKind(err error, kind string) bool

func IsErrClosed

func IsErrClosed(err error) bool

func IsErrClosedKind

func IsErrClosedKind(err error, kind string) bool

func IsErrInvalid

func IsErrInvalid(err error) bool

func IsErrInvalidKind

func IsErrInvalidKind(err error, kind string) bool

func IsErrNRequired added in v0.5.0

func IsErrNRequired(err error) bool

func IsErrNoMatch added in v0.7.0

func IsErrNoMatch(err error) bool

func IsErrNoMatchKind added in v0.7.0

func IsErrNoMatchKind(err error, kind string) bool

func IsErrNotFound

func IsErrNotFound(err error) bool

func IsErrNotFoundElem added in v0.5.0

func IsErrNotFoundElem(err error, kind, elem string) bool

func IsErrNotFoundKind

func IsErrNotFoundKind(err error, kind string) bool

func IsErrNotImplemented

func IsErrNotImplemented(err error) bool

func IsErrNotImplementedKind

func IsErrNotImplementedKind(err error, kind string) bool

func IsErrNotSupported

func IsErrNotSupported(err error) bool

func IsErrNotSupportedKind

func IsErrNotSupportedKind(err error, kind string) bool

func IsErrReadOnly

func IsErrReadOnly(err error) bool

func IsErrReadOnlyKind

func IsErrReadOnlyKind(err error, kind string) bool

func IsErrRecursionKind

func IsErrRecursionKind(err error, kind string) bool

func IsErrRecusion

func IsErrRecusion(err error) bool

func IsErrRequiredElem added in v0.5.0

func IsErrRequiredElem(err error, kind, elem string) bool

func IsErrRequiredKind added in v0.5.0

func IsErrRequiredKind(err error, kind string) bool

func IsErrStillInUse added in v0.3.0

func IsErrStillInUse(err error) bool

func IsErrStillInUseKind added in v0.3.0

func IsErrStillInUseKind(err error, kind string) bool

func IsErrUnknown

func IsErrUnknown(err error) bool

func IsErrUnknownKind

func IsErrUnknownKind(err error, kind string) bool

func IsRetryable

func IsRetryable(err error) bool

IsRetryable checks whether a retry should be performed for a failed operation.

func Join added in v0.3.0

func Join(errs ...error) error

Join combines any number of errors to a single error. If no or only nil errors are given nil is returned. If only one effective error is provided, this error is returned.

func LogError added in v0.7.0

func LogError(log logging.Logger, f ErrorFunction, msg string, keypair ...interface{})

func NewEf added in v0.3.0

func NewEf(cause error, msg string, args ...interface{}) error

NewEf provides an arror with an optional cause.

func Newf

func Newf(msg string, args ...interface{}) error

func PropagateError

func PropagateError(errp *error, f ErrorFunction)

PropagateError propagates a deferred error to the named return value whose address has to be passed as argument.

func PropagateErrorf

func PropagateErrorf(errp *error, f ErrorFunction, msg string, args ...interface{})

PropagateErrorf propagates an optional deferred error to the named return value whose address has to be passed as argument. All errors, including the original one, are wrapped by the given context.

func ToInterfaceSlice

func ToInterfaceSlice(list interface{}) []interface{}

func Wrap added in v0.3.0

func Wrap(err error, args ...interface{}) error

func Wrapf

func Wrapf(err error, msg string, args ...interface{}) error

Types

type AlreadyExistsError

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

func (*AlreadyExistsError) Ctx

func (e *AlreadyExistsError) Ctx() string

func (*AlreadyExistsError) CtxKind

func (e *AlreadyExistsError) CtxKind() string

func (*AlreadyExistsError) Elem

func (e *AlreadyExistsError) Elem() *string

func (*AlreadyExistsError) Error

func (e *AlreadyExistsError) Error() string

func (*AlreadyExistsError) Is added in v0.4.1

func (e *AlreadyExistsError) Is(o error) bool

func (*AlreadyExistsError) Kind

func (e *AlreadyExistsError) Kind() string

func (*AlreadyExistsError) SetKind

func (e *AlreadyExistsError) SetKind(kind string)

func (*AlreadyExistsError) Unwrap

func (e *AlreadyExistsError) Unwrap() error

type ClosedError

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

func (*ClosedError) Ctx

func (e *ClosedError) Ctx() string

func (*ClosedError) CtxKind

func (e *ClosedError) CtxKind() string

func (*ClosedError) Elem

func (e *ClosedError) Elem() *string

func (*ClosedError) Error

func (e *ClosedError) Error() string

func (*ClosedError) Is added in v0.4.1

func (e *ClosedError) Is(o error) bool

func (*ClosedError) Kind

func (e *ClosedError) Kind() string

func (*ClosedError) SetKind

func (e *ClosedError) SetKind(kind string)

func (*ClosedError) Unwrap

func (e *ClosedError) Unwrap() error

type ErrorFormatter

type ErrorFormatter interface {
	Format(kind string, elem *string, ctxkind string, ctx string) string
}

func NewDefaultFormatter

func NewDefaultFormatter(verb, msg, preposition string) ErrorFormatter

type ErrorFunction

type ErrorFunction func() error

type ErrorList

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

ErrorList is an error type with erros in it.

func ErrList

func ErrList(args ...interface{}) *ErrorList

func ErrListf

func ErrListf(msg string, args ...interface{}) *ErrorList

func (*ErrorList) Add

func (l *ErrorList) Add(errs ...error) *ErrorList

func (*ErrorList) Addf

func (l *ErrorList) Addf(writer io.Writer, err error, msg string, args ...interface{}) error

func (*ErrorList) Clear

func (l *ErrorList) Clear()

func (*ErrorList) Entries added in v0.3.0

func (l *ErrorList) Entries() []error

func (*ErrorList) Error

func (l *ErrorList) Error() string

func (*ErrorList) Len

func (l *ErrorList) Len() int

func (*ErrorList) Result

func (l *ErrorList) Result() error

func (*ErrorList) Unwrap added in v0.9.0

func (l *ErrorList) Unwrap() []error

type InvalidError

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

func (*InvalidError) Ctx

func (e *InvalidError) Ctx() string

func (*InvalidError) CtxKind

func (e *InvalidError) CtxKind() string

func (*InvalidError) Elem

func (e *InvalidError) Elem() *string

func (*InvalidError) Error

func (e *InvalidError) Error() string

func (*InvalidError) Is added in v0.4.1

func (e *InvalidError) Is(o error) bool

func (*InvalidError) Kind

func (e *InvalidError) Kind() string

func (*InvalidError) SetKind

func (e *InvalidError) SetKind(kind string)

func (*InvalidError) Unwrap

func (e *InvalidError) Unwrap() error

type Kinded

type Kinded interface {
	Kind() string
	SetKind(string)
}

type NoMatchError added in v0.7.0

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

func (*NoMatchError) Ctx added in v0.7.0

func (e *NoMatchError) Ctx() string

func (*NoMatchError) CtxKind added in v0.7.0

func (e *NoMatchError) CtxKind() string

func (*NoMatchError) Elem added in v0.7.0

func (e *NoMatchError) Elem() *string

func (*NoMatchError) Error added in v0.7.0

func (e *NoMatchError) Error() string

func (*NoMatchError) Is added in v0.7.0

func (e *NoMatchError) Is(o error) bool

func (*NoMatchError) Kind added in v0.7.0

func (e *NoMatchError) Kind() string

func (*NoMatchError) SetKind added in v0.7.0

func (e *NoMatchError) SetKind(kind string)

func (*NoMatchError) Unwrap added in v0.7.0

func (e *NoMatchError) Unwrap() error

type NotFoundError

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

func (*NotFoundError) Ctx

func (e *NotFoundError) Ctx() string

func (*NotFoundError) CtxKind

func (e *NotFoundError) CtxKind() string

func (*NotFoundError) Elem

func (e *NotFoundError) Elem() *string

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Is added in v0.4.1

func (e *NotFoundError) Is(o error) bool

func (*NotFoundError) Kind

func (e *NotFoundError) Kind() string

func (*NotFoundError) SetKind

func (e *NotFoundError) SetKind(kind string)

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type NotImplementedError

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

func (*NotImplementedError) Ctx

func (e *NotImplementedError) Ctx() string

func (*NotImplementedError) CtxKind

func (e *NotImplementedError) CtxKind() string

func (*NotImplementedError) Elem

func (e *NotImplementedError) Elem() *string

func (*NotImplementedError) Error

func (e *NotImplementedError) Error() string

func (*NotImplementedError) Is added in v0.4.1

func (e *NotImplementedError) Is(o error) bool

func (*NotImplementedError) Kind

func (e *NotImplementedError) Kind() string

func (*NotImplementedError) SetKind

func (e *NotImplementedError) SetKind(kind string)

func (*NotImplementedError) Unwrap

func (e *NotImplementedError) Unwrap() error

type NotSupportedError

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

func (*NotSupportedError) Ctx

func (e *NotSupportedError) Ctx() string

func (*NotSupportedError) CtxKind

func (e *NotSupportedError) CtxKind() string

func (*NotSupportedError) Elem

func (e *NotSupportedError) Elem() *string

func (*NotSupportedError) Error

func (e *NotSupportedError) Error() string

func (*NotSupportedError) Is added in v0.4.1

func (e *NotSupportedError) Is(o error) bool

func (*NotSupportedError) Kind

func (e *NotSupportedError) Kind() string

func (*NotSupportedError) SetKind

func (e *NotSupportedError) SetKind(kind string)

func (*NotSupportedError) Unwrap

func (e *NotSupportedError) Unwrap() error

type ReadOnlyError

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

func (*ReadOnlyError) Ctx

func (e *ReadOnlyError) Ctx() string

func (*ReadOnlyError) CtxKind

func (e *ReadOnlyError) CtxKind() string

func (*ReadOnlyError) Elem

func (e *ReadOnlyError) Elem() *string

func (*ReadOnlyError) Error

func (e *ReadOnlyError) Error() string

func (*ReadOnlyError) Is added in v0.4.1

func (e *ReadOnlyError) Is(o error) bool

func (*ReadOnlyError) Kind

func (e *ReadOnlyError) Kind() string

func (*ReadOnlyError) SetKind

func (e *ReadOnlyError) SetKind(kind string)

func (*ReadOnlyError) Unwrap

func (e *ReadOnlyError) Unwrap() error

type RecursionError

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

func (*RecursionError) Elem

func (e *RecursionError) Elem() interface{}

func (*RecursionError) Error

func (e *RecursionError) Error() string

func (*RecursionError) Kind

func (e *RecursionError) Kind() string

func (*RecursionError) Unwrap

func (e *RecursionError) Unwrap() error

type RequiredError added in v0.5.0

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

func (*RequiredError) Ctx added in v0.5.0

func (e *RequiredError) Ctx() string

func (*RequiredError) CtxKind added in v0.5.0

func (e *RequiredError) CtxKind() string

func (*RequiredError) Elem added in v0.5.0

func (e *RequiredError) Elem() *string

func (*RequiredError) Error added in v0.5.0

func (e *RequiredError) Error() string

func (*RequiredError) Is added in v0.5.0

func (e *RequiredError) Is(o error) bool

func (*RequiredError) Kind added in v0.5.0

func (e *RequiredError) Kind() string

func (*RequiredError) SetKind added in v0.5.0

func (e *RequiredError) SetKind(kind string)

func (*RequiredError) Unwrap added in v0.5.0

func (e *RequiredError) Unwrap() error

type StillInUseError added in v0.3.0

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

func (*StillInUseError) Ctx added in v0.3.0

func (e *StillInUseError) Ctx() string

func (*StillInUseError) CtxKind added in v0.3.0

func (e *StillInUseError) CtxKind() string

func (*StillInUseError) Elem added in v0.3.0

func (e *StillInUseError) Elem() *string

func (*StillInUseError) Error added in v0.3.0

func (e *StillInUseError) Error() string

func (*StillInUseError) Is added in v0.4.1

func (e *StillInUseError) Is(o error) bool

func (*StillInUseError) Kind added in v0.3.0

func (e *StillInUseError) Kind() string

func (*StillInUseError) SetKind added in v0.3.0

func (e *StillInUseError) SetKind(kind string)

func (*StillInUseError) Unwrap added in v0.3.0

func (e *StillInUseError) Unwrap() error

type UnknownError

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

func (*UnknownError) Ctx

func (e *UnknownError) Ctx() string

func (*UnknownError) CtxKind

func (e *UnknownError) CtxKind() string

func (*UnknownError) Elem

func (e *UnknownError) Elem() *string

func (*UnknownError) Error

func (e *UnknownError) Error() string

func (*UnknownError) Is added in v0.4.1

func (e *UnknownError) Is(o error) bool

func (*UnknownError) Kind

func (e *UnknownError) Kind() string

func (*UnknownError) SetKind

func (e *UnknownError) SetKind(kind string)

func (*UnknownError) Unwrap

func (e *UnknownError) Unwrap() error

Jump to

Keyboard shortcuts

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