burrito

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 5 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GroupErrorText = color.RedString("Additionally the following errors occurred:")

GroupErrorText is a string that is used to indicate a group of errors.

View Source
var PrintStackTrace = false

PrintStackTrace is a global variable that controls whether stack traces are printed or not.

Functions

func GetAllMessages added in v1.0.2

func GetAllMessages(err error) []string

GetAllMessages returns all messages of the error and all wrapped errors.

func GetProperty added in v1.0.4

func GetProperty(err error, key string) interface{}

GetProperty returns the property value for the specified key.

func GroupErrors added in v1.0.1

func GroupErrors(errs ...error) error

GroupErrors combines two or more errors into one. The first error is an error that occurred during the main operation. The other errors are errors that occurred during error handling.

func HasTag added in v1.0.2

func HasTag(err error, tag string) bool

HasTag returns true if the error is burrito error and has the specified tag.

func IsBurritoError added in v1.0.2

func IsBurritoError(err error) bool

IsBurritoError returns true if the error is a burrito error.

func PassError

func PassError(err error) error

PassError adds stack trace to an error without any additional text.

func WalkError added in v1.0.4

func WalkError(err error, fn func(err *Error) bool)

WalkError walks the error tree and calls the specified function for each error. If the function returns true, the walk is aborted.

func WrapError

func WrapError(err error, text string) error

WrapError wraps an error with a stack trace and adds additional text information.

func WrapErrorf

func WrapErrorf(err error, text string, args ...interface{}) error

WrapErrorf wraps an error with a stack trace and adds additional formatted text information.

func WrappedError

func WrappedError(text string) error

WrappedError creates an error with a stack trace from text.

func WrappedErrorf

func WrappedErrorf(text string, args ...interface{}) error

WrappedErrorf creates an error with a stack trace from formatted text.

Types

type Error

type Error struct {
	Err            error
	Message        *string
	File           string
	Line           int
	FuncName       string
	ShowStackTrace *bool
	Tags           []string
	Properties     map[string]interface{}
}

func AsBurritoError added in v1.0.2

func AsBurritoError(err error) *Error

AsBurritoError converts an error to a burrito error.

func (*Error) AddProperty added in v1.0.4

func (r *Error) AddProperty(key string, value interface{})

func (*Error) AddTag

func (r *Error) AddTag(tag string)

AddTag adds a tag to the error.

func (*Error) Error

func (r *Error) Error() string

func (*Error) ForceStackTrace

func (r *Error) ForceStackTrace(enabled bool)

ForceStackTrace overrides the global PrintStackTrace setting.

func (*Error) GetProperty added in v1.0.4

func (r *Error) GetProperty(key string) interface{}

func (*Error) HasProperty added in v1.0.4

func (r *Error) HasProperty(key string) bool

func (*Error) HasTag

func (r *Error) HasTag(tag string) bool

HasTag returns true if the error has the specified tag.

type ErrorGroup added in v1.0.1

type ErrorGroup struct {
	Errors []error
}

func (*ErrorGroup) Error added in v1.0.1

func (r *ErrorGroup) Error() string

Jump to

Keyboard shortcuts

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