errors

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorCollector

type ErrorCollector struct {

	// Used in Join to join the error messages.
	Sep string
	// Used in Join to format the contained message.
	// Should be some simple wrapping like `{%s}`.
	Fmt string
	// contains filtered or unexported fields
}

ErrorCollector can collect then combine multiple errors into one.

func NewErrorCollector

func NewErrorCollector() *ErrorCollector

func (*ErrorCollector) Add

func (e *ErrorCollector) Add(err error)

Add adds an error to the collector if it is not nil.

func (*ErrorCollector) IsEmpty

func (e *ErrorCollector) IsEmpty() bool

IsEmpty returns true if the collector has no errors.

func (*ErrorCollector) Join

func (e *ErrorCollector) Join() error

Join combines the errors formatted Fmt and separated by Sep. If the collector is empty, it returns nil.

func (*ErrorCollector) WithFormat

func (e *ErrorCollector) WithFormat(format string) *ErrorCollector

func (*ErrorCollector) WithSeparator

func (e *ErrorCollector) WithSeparator(sep string) *ErrorCollector

Jump to

Keyboard shortcuts

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