Documentation
¶
Index ¶
- Constants
- func Cause(err error) error
- func CheckErr(err error)
- func IsGoexerError(err error) bool
- func SetBLog(log *log.Logger)
- func SetDefaultOpts(opts ErrorOpts)
- func SetZLog(log *zerolog.Logger)
- type Container
- func (c *Container) Get(key string) any
- func (c *Container) GetE(key string) (any, bool)
- func (c *Container) GetRaw(key string) any
- func (c *Container) GetRawE(key string) (any, bool)
- func (c *Container) JSON() ([]byte, error)
- func (c *Container) Keys() []string
- func (c *Container) Marshaled() Marshaled
- func (c *Container) Set(key string, value interface{}) *Container
- func (c *Container) Size() int
- type Error
- func (e *Error) Cause() error
- func (e *Error) Error() string
- func (e *Error) Format(s fmt.State, verb rune)
- func (e *Error) Get(key string) any
- func (e *Error) GetE(key string) (any, bool)
- func (e *Error) GetRaw(key string) any
- func (e *Error) GetRawE(key string) (any, bool)
- func (e *Error) Is(err error) bool
- func (e *Error) LogError(msg ...string)
- func (e *Error) LogFatal(msg ...string)
- func (e *Error) LogTrace(msg ...string)
- func (e *Error) LogTraceToEvent(event *zerolog.Event, msg ...string)
- func (e *Error) MultiLinePrettyError() string
- func (e *Error) OneLinePrettyError() string
- func (e *Error) Set(key string, value interface{})
- func (e *Error) Stack() []*Error
- func (e *Error) StackString() string
- func (e *Error) Unwrap() error
- type ErrorOpts
- type ErrorWrap
- type Item
- type Marshaled
Constants ¶
View Source
const ( BaseErrorName = "BaseError" ErrorTypeString = "*goexer.Error" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container for extended data.
type Error ¶
type Error struct {
Message string // Error message.
Name string // Error name (kind). E.g. NotFound, ... Do not use long strings for better formatting.
Function string // Function where error was created.
File string // File with code definition.
Line uint // Line where error was created.
Previous *Error // Previous error.
Original error // Original error if wrap was used for non Error objects.
Container *Container
ShowContainerItems []string
ShowContainerSize bool
ShowContainerAsZKeys bool // Show container items as keys in zerolog, instead of as message.
AddTraceToError bool // Add trace messages to error and fatal messages with error level ERROR.
}
func (*Error) LogTraceToEvent ¶
Log trace to event.
func (*Error) MultiLinePrettyError ¶
Pretty string for error in one line style.
func (*Error) OneLinePrettyError ¶
Pretty string for error in one line style.
type ErrorOpts ¶
type ErrorOpts struct {
Name string // Name (kind) of error. Do not use long strings for better formatting.
Depth int // Depth of stack trace. Increase if need fetch data from previous frame.
Container *Container // Use existing container with prefilled data. Use nil for personal container for each error.
ShowContainerSize *bool // Show container size in error message.
ShowContainerItems []string // Show container items in error message (key and value).
ShowContainerAsZKeys *bool // Show container items as keys in zerolog, instead of as message.
AddTraceToError *bool // Add trace messages to error and fatal messages with error level ERROR.
}
Additional options for New(), Wrap(), ...
type ErrorWrap ¶
type ErrorWrap Error
Allow to print %#v (I need better method, because this brakes type name).
Click to show internal directories.
Click to hide internal directories.