errcount

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 2 Imported by: 5

Documentation

Overview

Package errcount provides an easy to use error counter which returns error count and last error so as to not overwhelm the user with errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCount

type ErrCount struct {
	// contains filtered or unexported fields
}

ErrCount stores the state of the error counter.

func New

func New() *ErrCount

New makes a new error counter

func (*ErrCount) Add

func (ec *ErrCount) Add(err error)

Add an error to the error count.

err may be nil.

Thread safe.

func (*ErrCount) Err

func (ec *ErrCount) Err(txt string) error

Err returns the error summary so far - may be nil

txt is put in front of the error summary

txt: %d errors: last error: %w

or this if only one error

txt: %w

Thread safe.

Jump to

Keyboard shortcuts

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