errors

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v1.1.3

func Contains(err, target error) bool

Contains validate message target contains on message err

func Is

func Is(err, target error) bool

Is validate equal errors

func IsErrorDetail

func IsErrorDetail(err error) bool

IsErrorDetail check if the error is an ErrorDetail containing the pattern with file name, line, function name, message and debugStack

func IsNot

func IsNot(err, target error) bool

IsNot validate not equal errors

func New

func New(message ...any) error

New error with space separated message values, if the message parameter is empty we return a nil value, otherwise returns normal value

func NewSkipCaller

func NewSkipCaller(skipCaller int, message ...any) error

NewSkipCaller error with message values separate per space and skipCaller, if the message parameter is empty we return a nil value, otherwise returns normal value

func NotContains added in v1.1.3

func NotContains(err, target error) bool

NotContains validate message target not contains on message err

Types

type ErrorDetail added in v1.0.9

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

func Details added in v1.1.0

func Details(err error) *ErrorDetail

Details we obtain the values of an error passed in the parameter, and transform them into an ErrorDetail object, if the passed parameter is null, the return will also be null and if it is not in the desired errorDetail pattern, we return a new ErrDetail with the message being the err passed in the parameter.

func (*ErrorDetail) Error added in v1.0.9

func (e *ErrorDetail) Error() string

Error print the error as a string, genetic implementation of error in go

func (*ErrorDetail) GetCause added in v1.1.0

func (e *ErrorDetail) GetCause() string

GetCause returns formatted error cause

func (*ErrorDetail) GetDebugStack added in v1.0.9

func (e *ErrorDetail) GetDebugStack() string

GetDebugStack returns the value of the error debugStack field

func (*ErrorDetail) GetFile added in v1.0.9

func (e *ErrorDetail) GetFile() string

GetFile returns the value of the error file field

func (*ErrorDetail) GetFuncName added in v1.0.9

func (e *ErrorDetail) GetFuncName() string

GetFuncName returns the value of the error funcName field

func (*ErrorDetail) GetLine added in v1.0.9

func (e *ErrorDetail) GetLine() int

GetLine returns the value of the error line field

func (*ErrorDetail) GetMessage added in v1.0.9

func (e *ErrorDetail) GetMessage() string

GetMessage returns the value of the error message field

func (*ErrorDetail) PrintCause added in v1.1.0

func (e *ErrorDetail) PrintCause()

PrintCause print red message with cause error

func (*ErrorDetail) PrintStackTrace added in v1.1.0

func (e *ErrorDetail) PrintStackTrace()

PrintStackTrace print red message with detail error and debug stack

Jump to

Keyboard shortcuts

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