errors

package
v0.0.0-...-525d511 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 219

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

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

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

func ErrNoMatch(spec ...string) error

func ErrNoMatchWrap

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

func ErrRequired(spec ...string) error

func ErrRequiredWrap

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

func ErrStillInUse

func ErrStillInUse(spec ...string) error

func ErrStillInUseWrap

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

func ErrUnknown

func ErrUnknown(spec ...string) error

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

func IsErrNRequired(err error) bool

func IsErrNoMatch

func IsErrNoMatch(err error) bool

func IsErrNoMatchKind

func IsErrNoMatchKind(err error, kind string) bool

func IsErrNotFound

func IsErrNotFound(err error) bool

func IsErrNotFoundElem

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

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

func IsErrRequiredKind

func IsErrRequiredKind(err error, kind string) bool

func IsErrStillInUse

func IsErrStillInUse(err error) bool

func IsErrStillInUseKind

func IsErrStillInUseKind(err error, kind string) bool

func IsErrUnknown

func IsErrUnknown(err error) bool

func IsErrUnknownKind

func IsErrUnknownKind(err error, kind string) bool

func IsOfType

func IsOfType[T error](err error) bool

func Join

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 NewEf

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

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

Wrap wraps an occurred error with a context message. If no error is given, no error is returned.

func Wrapf

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

Wrapf wraps an occurred error with a context message. If no error is given, no error is returned. The error context is formatted with fmt.Sprintf.

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

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

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

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

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

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

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

func (*NoMatchError) Ctx

func (e *NoMatchError) Ctx() string

func (*NoMatchError) CtxKind

func (e *NoMatchError) CtxKind() string

func (*NoMatchError) Elem

func (e *NoMatchError) Elem() *string

func (*NoMatchError) Error

func (e *NoMatchError) Error() string

func (*NoMatchError) Is

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

func (*NoMatchError) Kind

func (e *NoMatchError) Kind() string

func (*NoMatchError) SetKind

func (e *NoMatchError) SetKind(kind string)

func (*NoMatchError) Unwrap

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

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

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

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

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

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

func (*RequiredError) Ctx

func (e *RequiredError) Ctx() string

func (*RequiredError) CtxKind

func (e *RequiredError) CtxKind() string

func (*RequiredError) Elem

func (e *RequiredError) Elem() *string

func (*RequiredError) Error

func (e *RequiredError) Error() string

func (*RequiredError) Is

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

func (*RequiredError) Kind

func (e *RequiredError) Kind() string

func (*RequiredError) SetKind

func (e *RequiredError) SetKind(kind string)

func (*RequiredError) Unwrap

func (e *RequiredError) Unwrap() error

type StillInUseError

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

func (*StillInUseError) Ctx

func (e *StillInUseError) Ctx() string

func (*StillInUseError) CtxKind

func (e *StillInUseError) CtxKind() string

func (*StillInUseError) Elem

func (e *StillInUseError) Elem() *string

func (*StillInUseError) Error

func (e *StillInUseError) Error() string

func (*StillInUseError) Is

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

func (*StillInUseError) Kind

func (e *StillInUseError) Kind() string

func (*StillInUseError) SetKind

func (e *StillInUseError) SetKind(kind string)

func (*StillInUseError) Unwrap

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

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