errlist

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package errlist contains an ErrList type that combines multiple errors into a single error. The package draws inspiration from hashicorp's go-multierror package (https://github.com/hashicorp/go-multierror).

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromStrings

func FromStrings(str []string) error

FromStrings converts a list of error strings (e.g., when received in a serialized message) into an ErrList.

Types

type ErrList

type ErrList []error

ErrList holds a list of errors.

Example
var errs ErrList
errs = append(errs, fmt.Errorf("We looked!"))
errs = append(errs, fmt.Errorf("And we saw him!"))
errs = append(errs, fmt.Errorf("The Cat in the Hat!"))
var err error = errs.ErrorOrNil()
fmt.Println(err)
Output:

We looked!
And we saw him!
The Cat in the Hat!

func (ErrList) ErrorOrNil

func (e ErrList) ErrorOrNil() error

ErrorOrNil returns a single error that includes all of the errors in the provided ErrList, or nil if there are no errors.

Jump to

Keyboard shortcuts

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