errs2

package
v0.28.4 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

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 CodeMap

type CodeMap map[*errs.Class]rpcstatus.StatusCode

CodeMap is used to apply the correct rpc status code to error classes.

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.

type LoggingSanitizer

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

LoggingSanitizer consolidates logging of original errors with sanitization of internal errors.

func NewLoggingSanitizer

func NewLoggingSanitizer(wrapper *errs.Class, log *zap.Logger, codeMap CodeMap) *LoggingSanitizer

NewLoggingSanitizer creates a new LoggingSanitizer.

func (*LoggingSanitizer) Error

func (sanitizer *LoggingSanitizer) Error(msg string, err error) error

Error logs the message and error to the logger and returns the sanitized error.

Jump to

Keyboard shortcuts

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