errors

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIO is returned when underlying IO error is received.
	ErrIO = errors.New("IO error")

	// ErrMarshal is returned when an item can't be marshaled into JSON/YAML.
	ErrMarshal = errors.New("marshalling error")

	// ErrUnmarshal is returned when an item can't be unmarshaled from JSON/YAML.
	ErrUnmarshal = errors.New("unmarshalling error")
)

Functions

func Is

func Is(err1 error, err2 error) bool

Is compares two errors and returns true if they have the same message. If either is a NestedError, only the top-level message is checked.

func Wrap

func Wrap(newErr error, nestedErr error) error

Wrap will return a new error of the specified type, but wrapping the specified sub-error.

Types

type NestedError

type NestedError struct {
	Message string
	Err     error
}

NestedError contains an error inside another error (which may also be nested)

func (NestedError) Error

func (e NestedError) Error() string

Error returns the error message and the message of any wrapped error.

Jump to

Keyboard shortcuts

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