errorhelpers

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorList

type ErrorList struct {
	// contains filtered or unexported fields
}

ErrorList is a wrapper around many errors

func NewErrorList

func NewErrorList(start string) *ErrorList

NewErrorList returns a new ErrorList

func NewErrorListWithErrors

func NewErrorListWithErrors(start string, errors []error) *ErrorList

NewErrorListWithErrors returns a new ErrorList with the given errors.

func (*ErrorList) AddError

func (e *ErrorList) AddError(err error)

AddError adds the passed error to the list of errors if it is not nil

func (*ErrorList) AddErrors

func (e *ErrorList) AddErrors(errs ...error)

AddErrors adds the non-nil errors in the given slice to the list of errors.

func (*ErrorList) AddString

func (e *ErrorList) AddString(err string)

AddString adds a string based error to the list

func (*ErrorList) AddStringf

func (e *ErrorList) AddStringf(t string, args ...interface{})

AddStringf adds a templated string

func (*ErrorList) AddStrings

func (e *ErrorList) AddStrings(errs ...string)

AddStrings adds multiple string based errors to the list.

func (*ErrorList) AddWrap

func (e *ErrorList) AddWrap(err error, msg string)

AddWrap is a convenient wrapper around `AddError(errors.Wrap(err, msg))`.

func (*ErrorList) AddWrapf

func (e *ErrorList) AddWrapf(err error, format string, args ...interface{})

AddWrapf is a convenient wrapper around `AddError(errors.Wrapf(err, format, args...))`.

func (*ErrorList) ErrorStrings

func (e *ErrorList) ErrorStrings() []string

ErrorStrings returns all the error strings in this ErrorList as a slice, ignoring the start string.

func (*ErrorList) String

func (e *ErrorList) String() string

String converts the list to a string, returning empty if no errors were added.

func (*ErrorList) ToError

func (e *ErrorList) ToError() error

ToError returns an error if there were errors added or nil

Jump to

Keyboard shortcuts

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