errutil

package
v0.0.0-...-1327151 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package errutil provides common error types and utilities.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = xerrors.New("not implemented")

ErrNotImplemented is returned when feature is currently not implemented.

Functions

func AssertionFailure

func AssertionFailure(format string, args ...interface{}) error

AssertionFailure is used for an error resulting from the failure of an expected invariant.

func CheckClose

func CheckClose(errp *error, c io.Closer)

CheckClose closes c. If an error occurs it will be written to the error pointer errp, if it doesn't already reference an error. This is intended to allow you to properly check errors when defering a close call. In this case the error pointer should be the address of a named error return.

func UnexpectedType

func UnexpectedType(t interface{}) error

UnexpectedType builds an error for an unexpected type, typically in a type switch.

func UnhandledCase

func UnhandledCase(v interface{}) error

UnhandledCase builds an error for an unexpected value in a switch.

Types

type Errors

type Errors []error

Errors is a collection of errors.

func (*Errors) Add

func (e *Errors) Add(err ...error)

Add appends errors to the list.

func (Errors) Err

func (e Errors) Err() error

Err returns an error equivalent to this error list. If the list is empty, Err returns nil.

func (Errors) Error

func (e Errors) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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