multierr

package module
v0.0.0-...-550fe7b Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 3 Imported by: 1

README

multierr

MultiError combines several errors into one.

Documentation

Index

Constants

View Source
const DefSep = "; "

DefSep is a separator for error messages.

Variables

This section is empty.

Functions

func New

func New(arr []error) error

New creates a new MultiError.

func NewFrom

func NewFrom(ch <-chan error) error

NewFrom creates a new MultiError from the channel, waits while the last one will be closed.

Types

type MultiError

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

MultiError designed to combine several errors into one. Uses Sep to separate one error message from another.

func (*MultiError) Error

func (e *MultiError) Error() string

func (*MultiError) Get

func (e *MultiError) Get(i int) error

Get returns the i-th error.

func (*MultiError) Len

func (e *MultiError) Len() int

Len returns the number of errors.

func (*MultiError) Similar

func (e *MultiError) Similar(err *MultiError) bool

Similar checks if two MultiErrors are similar. Two MultiErrors are considered similar if they contain the same errors, even in a different order.

Jump to

Keyboard shortcuts

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