multierror

package
v0.0.0-...-b0c7fd6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error[T comparable] struct {
	// contains filtered or unexported fields
}

Error is a generic error type that allows to combine multiple errors into one. It is useful when you need to return multiple errors from a function.

func New

func New[T comparable]() *Error[T]

New creates a new Error.

func (*Error[T]) Add

func (m *Error[T]) Add(key T, err error)

Add adds an error to the Error.

func (*Error[T]) Combined

func (m *Error[T]) Combined() error

Combined returns the Error if it contains any errors, nil otherwise.

func (*Error[T]) Error

func (m *Error[T]) Error() string

Error returns a string representation of the error.

func (*Error[T]) First

func (m *Error[T]) First() error

First returns the first error.

func (*Error[T]) Get

func (m *Error[T]) Get(key T) (error, bool)

Get returns an error by key.

func (*Error[T]) Len

func (m *Error[T]) Len() int

Len returns the number of errors.

func (*Error[T]) Unwrap

func (m *Error[T]) Unwrap() []error

Unwrap returns a slice of errors.

Jump to

Keyboard shortcuts

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