errors

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cancelled added in v0.8.0

func Cancelled(err error) error

User annotates err as a context cancelled error.

func IsCancelledError added in v0.8.0

func IsCancelledError(err error) bool

IsCancelledError returns whether err is annotated as a context cancelled error.

func IsSystemError

func IsSystemError(err error) bool

IsSystemError returns whether err is not annotated as a user error.

func IsUserError

func IsUserError(err error) bool

IsUserError returns whether err is annotated as a user error.

func User added in v0.8.0

func User(err error) error

User annotates err as a user error.

Types

type CancelledError added in v0.8.0

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

A CancelledError wraps an underlying error to annotite at as being caused by the cancellation of a context. CancelledErrors are also annotated as UserErrors.

func (CancelledError) Error added in v0.8.0

func (err CancelledError) Error() string

Error returns err's underlying error string.

func (CancelledError) Unwrap added in v0.8.0

func (err CancelledError) Unwrap() error

Unwrap returns err's underlying error.

type UserError

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

A UserError wraps an underlying error to annotate it as being caused by user error. The underlying error string is returned directly, meaning the annotation can be detected using errors.As without the annotation affecting how the errors are communicated.

func (UserError) Error added in v0.8.0

func (err UserError) Error() string

Error returns err's underlying error string.

func (UserError) Unwrap added in v0.8.0

func (err UserError) Unwrap() error

Unwrap returns err's underlying error.

Jump to

Keyboard shortcuts

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