scerr

package
v19.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConsequence

func AddConsequence(err error, cons error) error

AddConsequence adds an error 'err' to the list of consequences

func Cause

func Cause(err error) (resp error)

Cause returns the cause of an error if it implements the causer interface

func Consequences

func Consequences(err error) []error

Consequences returns the list of consequences

func DecorateError

func DecorateError(err error, action string, timeout time.Duration) error

DecorateError changes the error to something more comprehensible when timeout occurred

func ErrListError

func ErrListError(errors []error) error

ErrListError creates a ErrList

func IsGRPCTimeout

func IsGRPCTimeout(err error) bool

IsGRPCTimeout tells if the err is a timeout kind

func OnExitLogError

func OnExitLogError(in string, err *error) func()

OnExitLogError returns a function that will log error with level logrus.ErrorLevel. Intended to be used with defer for example

func OnExitLogErrorWithLevel

func OnExitLogErrorWithLevel(in string, err *error, level logrus.Level) func()

OnExitLogErrorWithLevel returns a function that will log error with the log level wanted Intended to be used with defer for example.

func OnExitTraceError

func OnExitTraceError(in string, err *error) func()

OnExitTraceError returns a function that will log error with level logrus.TraceLevel. Intended to be used with defer for example.

func OnPanic

func OnPanic(err *error) func()

OnPanic returns a function intended to capture panic error and fill the error pointer with a ErrRuntimePanic.

Types

type ErrAborted

type ErrAborted struct {
	ErrCore
}

ErrAborted ...

func AbortedError

func AbortedError() ErrAborted

AbortedError creates a ErrAborted error

func (ErrAborted) AddConsequence

func (e ErrAborted) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrCore

type ErrCore struct {
	Message string
	// contains filtered or unexported fields
}

ErrCore ...

func NewErrCore

func NewErrCore(message string, cause error, consequences []error) ErrCore

NewErrCore creates a new error with a message 'message', a cause error 'cause' and a list of teardown problems 'consequences'

func Wrap

func Wrap(cause error, message string) ErrCore

Wrap creates a new error with a message 'message' and a cause error 'cause'

func (ErrCore) AddConsequence

func (e ErrCore) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

func (ErrCore) Cause

func (e ErrCore) Cause() error

Cause returns an error's cause

func (ErrCore) CauseFormatter

func (e ErrCore) CauseFormatter() string

CauseFormatter generates a string containing information about the causing error and the derived errors while trying to clean up

func (ErrCore) Consequences

func (e ErrCore) Consequences() []error

Consequences returns the consequences of current error (detected teardown problems)

func (ErrCore) Error

func (e ErrCore) Error() string

Error returns a human-friendly error explanation

func (ErrCore) Reset

func (e ErrCore) Reset(err error) ErrCore

Reset imports content of error err to receiving error e

type ErrDuplicate

type ErrDuplicate struct {
	ErrCore
}

ErrDuplicate already exists error

func DuplicateError

func DuplicateError(msg string) ErrDuplicate

DuplicateError creates a ErrDuplicate error

func (ErrDuplicate) AddConsequence

func (e ErrDuplicate) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrForbidden

type ErrForbidden struct {
	ErrCore
}

ErrForbidden when action is not allowed.

func ForbiddenError

func ForbiddenError(msg string) ErrForbidden

ForbiddenError creates a ErrForbidden error

func (ErrForbidden) AddConsequence

func (e ErrForbidden) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrInconsistent

type ErrInconsistent struct {
	ErrCore
}

ErrInconsistent is used when data used is inconsistent

func InconsistentError

func InconsistentError(msg string) ErrInconsistent

InconsistentError creates a ErrInconsistent error

func (ErrInconsistent) AddConsequence

func (e ErrInconsistent) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrInvalidInstance

type ErrInvalidInstance struct {
	ErrCore
}

ErrInvalidInstance has to be used when a method is called from an instance equal to nil

func InvalidInstanceError

func InvalidInstanceError() ErrInvalidInstance

InvalidInstanceError creates a ErrInvalidInstance error

func (ErrInvalidInstance) AddConsequence

func (e ErrInvalidInstance) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrInvalidInstanceContent

type ErrInvalidInstanceContent struct {
	ErrCore
}

ErrInvalidInstanceContent has to be used when a property of an instance contains invalid property

func InvalidInstanceContentError

func InvalidInstanceContentError(what, why string) ErrInvalidInstanceContent

InvalidInstanceContentError ...

func (ErrInvalidInstanceContent) AddConsequence

func (e ErrInvalidInstanceContent) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrInvalidParameter

type ErrInvalidParameter struct {
	ErrCore
}

ErrInvalidParameter ...

func InvalidParameterError

func InvalidParameterError(what, why string) ErrInvalidParameter

InvalidParameterError creates a ErrInvalidParameter error

func (ErrInvalidParameter) AddConsequence

func (e ErrInvalidParameter) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrInvalidRequest

type ErrInvalidRequest struct {
	ErrCore
}

ErrInvalidRequest ...

func InvalidRequestError

func InvalidRequestError(msg string) ErrInvalidRequest

InvalidRequestError creates a ErrInvalidRequest error

func (ErrInvalidRequest) AddConsequence

func (e ErrInvalidRequest) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrList

type ErrList struct {
	ErrCore
	// contains filtered or unexported fields
}

ErrList ...

func (ErrList) AddConsequence

func (e ErrList) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

func (ErrList) Error

func (e ErrList) Error() string

type ErrNotAvailable

type ErrNotAvailable struct {
	ErrCore
}

ErrNotAvailable resource not available error

func NotAvailableError

func NotAvailableError(msg string) ErrNotAvailable

NotAvailableError creates a NotAvailable error

func (ErrNotAvailable) AddConsequence

func (e ErrNotAvailable) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrNotFound

type ErrNotFound struct {
	ErrCore
}

ErrNotFound resource not found error

func NotFoundError

func NotFoundError(msg string) ErrNotFound

NotFoundError creates a ErrNotFound error

func (ErrNotFound) AddConsequence

func (e ErrNotFound) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrNotImplemented

type ErrNotImplemented struct {
	ErrCore
}

ErrNotImplemented ...

func NotImplementedError

func NotImplementedError(what string) ErrNotImplemented

NotImplementedError creates a ErrNotImplemented error

func (ErrNotImplemented) AddConsequence

func (e ErrNotImplemented) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrOverflow

type ErrOverflow struct {
	ErrCore
}

ErrOverflow ...

func OverflowError

func OverflowError(msg string) ErrOverflow

OverflowError creates a ErrOverflow error

func (ErrOverflow) AddConsequence

func (e ErrOverflow) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrOverload

type ErrOverload struct {
	ErrCore
}

ErrOverload when action cannot be honored because provider is overloaded (ie too many requests occured in a given time).

func OverloadError

func OverloadError(msg string) ErrOverload

OverloadError creates a ErrOverload error

func (ErrOverload) AddConsequence

func (e ErrOverload) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrRuntimePanic

type ErrRuntimePanic struct {
	ErrCore
}

ErrRuntimePanic ...

func RuntimePanicError

func RuntimePanicError(msg string) ErrRuntimePanic

RuntimePanicError creates a ErrRuntimePanic error

type ErrTimeout

type ErrTimeout struct {
	ErrCore
	// contains filtered or unexported fields
}

ErrTimeout defines a Timeout error

func TimeoutError

func TimeoutError(msg string, timeout time.Duration, cause error) ErrTimeout

TimeoutError ...

func (ErrTimeout) AddConsequence

func (e ErrTimeout) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrUnauthorized

type ErrUnauthorized struct {
	ErrCore
}

ErrUnauthorized when action is done without being authenticated first

func UnauthorizedError

func UnauthorizedError(msg string) ErrUnauthorized

UnauthorizedError creates a ErrUnauthorized error

func (ErrUnauthorized) AddConsequence

func (e ErrUnauthorized) AddConsequence(err error) error

AddConsequence adds an error 'err' to the list of consequences

type ErrorLike

type ErrorLike interface {
	IsError() bool
}

ErrorLike interface

type Status

type Status interface {
	Message() string
	Cause() error
	IsError() bool
}

Status interface

func Success

func Success(msg string, args ...interface{}) Status

Success ..

func WrapErr

func WrapErr(err error, msg string) Status

WrapErr ...

Jump to

Keyboard shortcuts

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