errors

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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