burrito

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 6 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 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 PassError

func PassError(err error) error

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

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
}

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) 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