errors

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is

func Is(err, target error) bool

Is validate equal errors, if errorDetail we only consider the errorDetail.Message field

func IsErrorDetail

func IsErrorDetail(err error) bool

IsErrorDetail check if error interface is errorDetail

func IsNot

func IsNot(err, target error) bool

IsNot validate not equal errors, if errorDetail we only consider the errorDetail.Message field

Types

type Error added in v1.0.5

type Error struct {
	// File name file from caller new error
	File string `json:"file,omitempty"`
	// Line from caller new error
	Line int `json:"line,omitempty"`
	// Message error
	Message string `json:"message,omitempty"`
	// Endpoint from error
	Endpoint string `json:"endpoint,omitempty"`
}

func New

func New(message ...any) *Error

New error detail with message values separate per space

func NewEndpoint added in v1.0.5

func NewEndpoint(endpoint string, message ...any) *Error

NewEndpoint error detail with endpoint and message

func NewEndpointSkipCaller added in v1.0.5

func NewEndpointSkipCaller(skipCaller int, endpoint string, message ...any) *Error

NewEndpointSkipCaller error detail with message values separate per space with skipCaller and endpoint

func NewSkipCaller

func NewSkipCaller(skipCaller int, message ...any) *Error

NewSkipCaller error detail with message values separate per space and skipCaller

func ParseToError added in v1.0.5

func ParseToError(a any) *Error

ParseToError parse value to error struct, if value an is not an Error, we create a new one from it as Error.Message.

func (*Error) Error added in v1.0.5

func (e *Error) Error() string

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

Jump to

Keyboard shortcuts

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