xberror

package
v0.0.0-...-70497d9 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggravate

func Aggravate(err error) error

func As

func As(err error, target any) bool

func Is

func Is(err, target error) bool

func Unwrap

func Unwrap(err error) []error

Types

type CustomError

type CustomError interface {
	NestedError
	Message() *Message
	Options() *Options
	OutText() string
	OutArgs() []any
	LogText() string
	LogArgs() []any
	LogFields() LogFields
}

func AsCustomError

func AsCustomError(err error) (target CustomError, ok bool)

type Error

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

func AsError

func AsError(err error) (target *Error, ok bool)

func New

func New(message string) *Error

func Newf

func Newf(message string, args []any) *Error

func (*Error) Error

func (err *Error) Error() string

type InternalError

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

func AsInternalError

func AsInternalError(err error) (target *InternalError, ok bool)

func Internal

func Internal(message *Message, options *Options, errs ...error) *InternalError

func (*InternalError) Error

func (err *InternalError) Error() string

func (*InternalError) LogArgs

func (err *InternalError) LogArgs() []any

func (*InternalError) LogFields

func (err *InternalError) LogFields() LogFields

func (*InternalError) LogText

func (err *InternalError) LogText() string

func (*InternalError) Message

func (err *InternalError) Message() *Message

func (*InternalError) Options

func (err *InternalError) Options() *Options

func (*InternalError) OutArgs

func (err *InternalError) OutArgs() []any

func (*InternalError) OutText

func (err *InternalError) OutText() string

func (*InternalError) Unwrap

func (err *InternalError) Unwrap() []error

type LogFields

type LogFields = logrus.Fields

type Message

type Message = xbmtmsg.MetaMessage

type NestedError

type NestedError interface {
	Error() string
	Unwrap() []error
}

func AsNestedError

func AsNestedError(err error) (target NestedError, ok bool)

type Options

type Options = internalErrorOptions

type UnexpectedError

type UnexpectedError struct {
	*InternalError
}

func AsUnexpectedError

func AsUnexpectedError(err error) (target *UnexpectedError, ok bool)

func Unexpected

func Unexpected(message *Message, options *Options, errs ...error) *UnexpectedError

func (*UnexpectedError) Error

func (err *UnexpectedError) Error() string

type ValidationError

type ValidationError struct {
	*InternalError
}

func AsValidationError

func AsValidationError(err error) (target *ValidationError, ok bool)

func Validation

func Validation(message *Message, options *Options, errs ...error) *ValidationError

func (*ValidationError) Error

func (err *ValidationError) Error() string

type WrapError

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

func AsWrapError

func AsWrapError(err error) (target *WrapError, ok bool)

func Wrap

func Wrap(message string, errs ...error) *WrapError

func Wrapf

func Wrapf(message string, args []any, errs ...error) *WrapError

func (*WrapError) Error

func (err *WrapError) Error() string

func (*WrapError) Unwrap

func (err *WrapError) Unwrap() []error

Jump to

Keyboard shortcuts

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