errors

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultGroupOpts = GroupOptions{
		Context:          context.Background(),
		Finalizer:        waitFinalizer,
		ConcurrencyLimit: 1,
	}
)
View Source
var NewlineDelimited = ReportWithDelimiter("\n")

Functions

func FormatString

func FormatString(err Formatter) string

func ReportErrors

func ReportErrors(r Reporter, errs Errors, w io.Writer) (e error)

func ReportToString

func ReportToString(r Reporter, err error) (s string, e error)

Types

type ErrGroup

type ErrGroup = errgroup.Group

type ErrGroupFinalizer

type ErrGroupFinalizer interface {
	FinalizeErrGroup(*ErrGroup) error
}

type ErrGroupSetup

type ErrGroupSetup interface {
	SetupErrGroup(*ErrGroup)
}

type ErrGroupWait

type ErrGroupWait struct{}

func (ErrGroupWait) FinalizeErrGroup

func (ErrGroupWait) FinalizeErrGroup(gp *ErrGroup) error

type Errors

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

func WithLen

func WithLen(length int) Errors

func WithLengthCap

func WithLengthCap(length, capacity int) Errors

func Wrap

func Wrap(errs []error) Errors

func (*Errors) Append

func (errs *Errors) Append(errors []error)

func (*Errors) AppendIf

func (errs *Errors) AppendIf(err error)

AppendIf will only append the error if it is non nil.

func (*Errors) AppendOne

func (errs *Errors) AppendOne(err error)

func (Errors) GetErrors

func (errs Errors) GetErrors() []error

func (Errors) WithReporter

func (errs Errors) WithReporter(reporter Reporter) WithReporter

type Formatter

type Formatter interface {
	FormatError(w io.Writer) error
}

type Group

type Group interface {
	Go(GroupFunc)
	TryGo(GroupFunc) bool
	Wait() error
}

type GroupFunc

type GroupFunc func() error

type GroupMaker

type GroupMaker interface {
	NewErrGroup() (Group, error)
}

type GroupOptions

type GroupOptions struct {
	Context          context.Context
	Finalizer        ErrGroupFinalizer
	ConcurrencyLimit int
}

func (GroupOptions) NewErrGroup

func (opt GroupOptions) NewErrGroup() (Group, error)

func (GroupOptions) SetupErrGroup

func (opt GroupOptions) SetupErrGroup(gr *ErrGroup)

type GroupRef

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

func (GroupRef) Go

func (gr GroupRef) Go(fn GroupFunc)

func (GroupRef) TryGo

func (gr GroupRef) TryGo(fn GroupFunc) bool

func (GroupRef) Wait

func (gr GroupRef) Wait() error

type Iter

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

TODO: implement error interface

func (*Iter) Unwrap

func (it *Iter) Unwrap() error

type Multi

type Multi interface {
	AddErr(error)
	Err() error
}

type MultiMaker

type MultiMaker interface {
	NewMultiErr() (Multi, error)
}

type MultiReporter

type MultiReporter interface {
	ReportErrors(errs Errors, w io.Writer) error
}

type Reporter

type Reporter interface {
	ReportError(err error, w io.Writer) (e error)
}

type UnwrapReport

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

func ReportWithDelimiter

func ReportWithDelimiter(delim string) (u UnwrapReport)

func (UnwrapReport) ReportError

func (u UnwrapReport) ReportError(err error, w io.Writer) (e error)

type WithReporter

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

func (WithReporter) Error

func (wr WithReporter) Error() string

Jump to

Keyboard shortcuts

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