errs2

package
v0.0.0-...-13747d4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 5 Imported by: 51

Documentation

Overview

Package errs2 collects common error handling functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collect

func Collect(errch chan error, duration time.Duration) error

Collect returns first error from channel and all errors that happen within duration.

func IgnoreCanceled

func IgnoreCanceled(err error) error

IgnoreCanceled returns nil, when the operation was about canceling.

func IsCanceled

func IsCanceled(err error) bool

IsCanceled returns true, when the error is a cancellation.

func IsRPC

func IsRPC(err error, code rpcstatus.StatusCode) bool

IsRPC checks if err contains an RPC error with the given status code.

Types

type Group

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

Group is a collection of goroutines working on subtasks that are part of the same overall task.

func (*Group) Go

func (group *Group) Go(f func() error)

Go calls the given function in a new goroutine.

func (*Group) Wait

func (group *Group) Wait() []error

Wait blocks until all function calls from the Go method have returned, then returns all errors (if any) from them.

Jump to

Keyboard shortcuts

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