Documentation
¶
Index ¶
- func ContainsError(lookFor, err error) (error, map[string]interface{}, bool)
- func ContainsErrorPrefix(prefixMsg string, err error) (error, map[string]interface{}, bool)
- type GenericError
- type WrappedError
- type WrappedErrorImpl
- func NewWithError(actual error) *WrappedErrorImpl
- func NewWithErrorAndFields(actual error, fields map[string]interface{}) *WrappedErrorImpl
- func NewWithMsg(message string) *WrappedErrorImpl
- func NewWithMsgAndFields(message string, fields map[string]interface{}) *WrappedErrorImpl
- func WithError(previous error, actual error) *WrappedErrorImpl
- func WithErrorAndFields(previous error, actual error, fields map[string]interface{}) *WrappedErrorImpl
- func (e *WrappedErrorImpl) Error() string
- func (e WrappedErrorImpl) GetActual() error
- func (e WrappedErrorImpl) GetAllFields() map[string]interface{}
- func (e WrappedErrorImpl) GetFields() map[string]interface{}
- func (e WrappedErrorImpl) GetPrevious() error
- func (e WrappedErrorImpl) GetStacktrace() string
- func (e WrappedErrorImpl) IsWrappedError() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsError ¶
ContainsError takes an error to look for and the error that needs to analyse. It compares the errors by comparing the string returned by Error().
Types ¶
type GenericError ¶
GenericError is an interface of the error to use as an example of how to write a Contains function.
func ContainsGenericError ¶
func ContainsGenericError(err error) (GenericError, map[string]interface{}, bool)
ContainsGenericError takes an error and returns a concrete error if it is present in the error chain.
type WrappedError ¶
type WrappedError interface {
error
IsWrappedError() bool
GetPrevious() error
GetActual() error
GetFields() map[string]interface{}
GetAllFields() map[string]interface{}
GetStacktrace() string
}
WrappedError specifies the interface for a wrapped error.
type WrappedErrorImpl ¶
type WrappedErrorImpl struct {
// contains filtered or unexported fields
}
WrappedErrorImpl is a wrapper for an error chain that allow to specify errors fields.
func NewWithError ¶
func NewWithError(actual error) *WrappedErrorImpl
NewWithError returns a new WrappedErrorImpl with the provided error.
func NewWithErrorAndFields ¶
func NewWithErrorAndFields(actual error, fields map[string]interface{}) *WrappedErrorImpl
NewWithErrorAndFields returns a new WrappedErrorImpl with the provided error and fields.
func NewWithMsg ¶
func NewWithMsg(message string) *WrappedErrorImpl
NewWithMsg returns a new WrappedErrorImpl with the provided message.
func NewWithMsgAndFields ¶
func NewWithMsgAndFields(message string, fields map[string]interface{}) *WrappedErrorImpl
NewWithMsgAndFields returns a new WrappedErrorImpl with the provided message and fields.
func WithError ¶
func WithError(previous error, actual error) *WrappedErrorImpl
WithError takes the previous error and the actual error and, returns a new WrappedErrorImpl.
func WithErrorAndFields ¶
func WithErrorAndFields(previous error, actual error, fields map[string]interface{}) *WrappedErrorImpl
WithErrorAndFields takes the previous error, the actual error and the fields associated with it and returns a new WrappedErrorImpl.
func (*WrappedErrorImpl) Error ¶
func (e *WrappedErrorImpl) Error() string
Error returns stack of all the wrapped error messages and it associated fields.
func (WrappedErrorImpl) GetActual ¶
func (e WrappedErrorImpl) GetActual() error
GetActual returns the actual wrapped error in the chain.
func (WrappedErrorImpl) GetAllFields ¶
func (e WrappedErrorImpl) GetAllFields() map[string]interface{}
GetAllFields returns a map of the fields for all the errors that had been wrap in the chain.
func (WrappedErrorImpl) GetFields ¶
func (e WrappedErrorImpl) GetFields() map[string]interface{}
GetFields returns the fields associated with the actual error.
func (WrappedErrorImpl) GetPrevious ¶
func (e WrappedErrorImpl) GetPrevious() error
GetPrevious returns the previous error in the chain.
func (WrappedErrorImpl) GetStacktrace ¶
func (e WrappedErrorImpl) GetStacktrace() string
GetStacktrace returns the stack trace of the first error in the chain.
func (WrappedErrorImpl) IsWrappedError ¶
func (e WrappedErrorImpl) IsWrappedError() bool
IsWrappedError returns always true for this error type.