Documentation ¶
Overview ¶
Package errors provides lightweight error handling and classification primitives.
The package provides simple error handling interfaces and functions. It allows to create simple and detailed classified errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInternal = errors.New("internal error")
ErrInternal is an internal neuron error definition.
Functions ¶
Types ¶
type DetailedError ¶ added in v0.16.0
type DetailedError struct { // ID is a unique error instance identification number. ID uuid.UUID // details contains the detailed information. Details string // message is a message used as a string for the // golang error interface implementation. Message string // Operation is the operation name when the error occurred. Operation string // contains filtered or unexported fields }
DetailedError is the class based error definition. Each instance has it's own traceable ID. It contains also a Class variable that might be comparable in logic.
func WrapDet ¶ added in v0.16.1
func WrapDet(err error, message string) *DetailedError
WrapDet wraps 'err' error and creates DetailedError with given 'message'.
func WrapDetf ¶ added in v0.16.1
func WrapDetf(err error, format string, args ...interface{}) *DetailedError
WrapDetf wraps 'err' error and created DetailedError with formatted message.
func (*DetailedError) Error ¶ added in v0.16.0
func (e *DetailedError) Error() string
DetailedError implements error interface.
func (*DetailedError) Unwrap ¶ added in v0.16.1
func (e *DetailedError) Unwrap() error
Unwrap unwraps provided error.
func (*DetailedError) WithDetail ¶ added in v0.16.0
func (e *DetailedError) WithDetail(detail string) *DetailedError
WithDetail sets error detail.
func (*DetailedError) WithDetailf ¶ added in v0.16.0
func (e *DetailedError) WithDetailf(format string, values ...interface{}) *DetailedError
WithDetailf sets error detail.
type MultiError ¶ added in v0.16.0
type MultiError []error
MultiError is the slice of errors parsable into a single error.
func (MultiError) Error ¶ added in v0.16.0
func (m MultiError) Error() string
Error implements error interface.
func (MultiError) Is ¶ added in v0.17.0
func (m MultiError) Is(err error) bool
Is checks if one of the errors is equal to 'err'.