errz

package
v16.0.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextDone

func ContextDone(err error) bool

func NewUserError

func NewUserError(msg string) error

func NewUserErrorWithCause

func NewUserErrorWithCause(cause error, msg string) error

func NewUserErrorWithCausef

func NewUserErrorWithCausef(cause error, format string, args ...interface{}) error

func NewUserErrorf

func NewUserErrorf(format string, args ...interface{}) error

func SafeCall

func SafeCall(toCall func() error, err *error)

func SafeClose

func SafeClose(toClose io.Closer, err *error)

Types

type ErrReporter

type ErrReporter interface {
	// HandleProcessingError can be used to handle errors occurring while processing a request.
	// If err is a (or wraps a) errz.UserError, it might be handled specially.
	HandleProcessingError(ctx context.Context, log *zap.Logger, msg string, err error)
}

ErrReporter provides a way to report errors.

type UserError

type UserError struct {
	// Message is a textual description of what's wrong.
	// Must be suitable to show to the user.
	Message string
	// Cause optionally holds an underlying error.
	Cause error
}

UserError is an error that happened because the user messed something up: - invalid syntax - invalid configuration

func (UserError) Error

func (e UserError) Error() string

func (UserError) Unwrap

func (e UserError) Unwrap() error

Jump to

Keyboard shortcuts

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