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
Click to show internal directories.
Click to hide internal directories.