errors

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorDetails added in v1.0.6

func GetErrorDetails(err error) (file, line, funcName, message string)

GetErrorDetails we obtain the values of an error detail separately, if the parameter is nil we return all empty values, and if the passed error parameter is not in the desired pattern, we return only the filled message and the rest empty.

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 and message

func IsNot

func IsNot(err, target error) bool

IsNot validate not equal errors

Types

type ErrorDetail added in v1.0.9

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

func New

func New(message ...any) *ErrorDetail

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) *ErrorDetail

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 (*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) 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) PrintStack added in v1.0.9

func (e *ErrorDetail) PrintStack()

PrintStack 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