errors

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 1 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

Cause returns the underlying cause of the error, if possible.

func Errorf

func Errorf(format string, args ...any) error

Errorf formats according to a format specifier and returns the string as a value that satisfies error. Errorf also records the stack trace at the point it was called.

func HasCause

func HasCause(source, target error) bool

HasCause recursively checks errors wrapped using Wrapf until it detects the target error

func HasType

func HasType(source, target error) bool

HasType recursively checks errors wrapped using Wrapf until it detects the target error type

func Is

func Is(source, target error) bool

Is recursively checks errors wrapped using Wrapf until it detects the target error

func Join added in v0.6.0

func Join(errs ...error) error

Join returns an error that wraps the given errors.

func New

func New(msg string) error

New returns an error with the supplied message. New also records the stack trace at the point it was called.

func WithMessage added in v0.6.0

func WithMessage(err error, format string) error

WithMessage annotates err with the format specifier.

func WithMessagef

func WithMessagef(err error, format string, args ...any) error

WithMessagef annotates err with the format specifier.

func WithStack added in v0.6.0

func WithStack(err error) error

func Wrap

func Wrap(err error, message string) error

Wrap wraps an error in a way compatible with HasCause

func Wrapf

func Wrapf(err error, format string, args ...any) error

Wrapf wraps an error in a way compatible with HasCause

Types

This section is empty.

Jump to

Keyboard shortcuts

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