errctx

package
v0.0.0-...-690b2a9 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCenter

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

ErrCenter is used to receive errors and provide ways to detect the error(s).

func NewErrCenter

func NewErrCenter() *ErrCenter

NewErrCenter creates a new ErrCenter.

func (*ErrCenter) CheckError

func (c *ErrCenter) CheckError() error

CheckError retusn the recorded error

func (*ErrCenter) OnError

func (c *ErrCenter) OnError(err error)

OnError receivers an error, if the error center has received one, drops the new error and records a warning log. Otherwise the error will be recorded and doneCh will be closed to use as notification.

func (*ErrCenter) WithCancelOnFirstError

func (c *ErrCenter) WithCancelOnFirstError(ctx context.Context) (context.Context, context.CancelFunc)

WithCancelOnFirstError creates an error context which will cancel the context when the first error is received.

Jump to

Keyboard shortcuts

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