util

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextualizeIfNeeded

func ContextualizeIfNeeded(msg string, err error) error

ContextualizeIfNeeded is a helper function to turn an error into a ContextualError if it is not already one

func LogWithContextIfNeeded

func LogWithContextIfNeeded(msg string, err error, l *logrus.Logger)

LogWithContextIfNeeded is a helper function to log an error line for an error or ContextualError

Types

type ContextualError

type ContextualError struct {
	RealError error
	Fields    map[string]interface{}
	Context   string
}

func NewContextualError

func NewContextualError(msg string, fields map[string]interface{}, realError error) *ContextualError

func (*ContextualError) Error

func (ce *ContextualError) Error() string

func (*ContextualError) Log

func (ce *ContextualError) Log(lr *logrus.Logger)

func (*ContextualError) Unwrap

func (ce *ContextualError) Unwrap() error

Jump to

Keyboard shortcuts

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