Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ShowStackTrace bool = false
ShowStackTrace in Error Message
Functions ¶
Types ¶
type ErrCallback ¶
type ErrCallback func(level ErrorLevel, err string, tags ...string)
ErrCallback function to handle given error
type Error ¶
type Error interface { // WithTag assigns tag[s] to Error WithTag(tag ...string) Error // WithLevel assigns given ErrorLevel WithLevel(level ErrorLevel) Error // Error is interface method of 'error' Error() string // Wraps existing error with errors (skips if passed error is nil) Wrap(err ...error) Error // Msgf wraps error with given message Msgf(format string, args ...any) Error // Equal Checks Equality of errors Equal(err ...error) bool // WithCallback execute ErrCallback function when Error is triggered WithCallback(handle ErrCallback) Error }
Error is enriched version of normal error with tags, stacktrace and other methods
func NewWithErr ¶
func NewWithTag ¶
NewWithTag creates an error with tag
func WrapfWithNil ¶
WrapfWithNil returns nil if error is nil but if err is not nil wraps error with given msg unlike errors.Wrapf
func WrapwithNil ¶
WrapwithNil returns nil if err is nil but wraps it with given errors continuously if it is not nil
type ErrorLevel ¶
type ErrorLevel uint
const ( Panic ErrorLevel = iota Fatal Runtime // Default )
func (ErrorLevel) String ¶
func (l ErrorLevel) String() string
Click to show internal directories.
Click to hide internal directories.