errors

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenErrors

func FlattenErrors(errs ...error) error

FlattenErrors possibly creates a MultiError. Nil entries are ignored. If all provided errors are nil (or nothing is provided), nil is returned. If only one non-nil error is provided, it is returned unchanged. If two or more non-nil errors are provided, the returned error will be of type *MultiError and it will contain each non-nil error.

func LogErrors added in v1.1.0

func LogErrors(logger *zerolog.Logger, msg string, err error)

Types

type MultiError

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

MultiError is an error combining multiple other errors. It will never have 0 or 1 errors. It will always have two or more.

func (*MultiError) Error

func (e *MultiError) Error() string

Error implements the error interface for a MultiError.

func (MultiError) GetErrors

func (e MultiError) GetErrors() []error

GetErrors gets all the errors that make up this MultiError.

func (MultiError) Len

func (e MultiError) Len() int

Len gets the number of errors in this MultiError.

func (MultiError) String

func (e MultiError) String() string

String implements the string interface for a MultiError.

Jump to

Keyboard shortcuts

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