errutil

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: AGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(err error, errs ...error) error

Append combines the provided error with a list of errors.

func As

func As[T error](err error) (target T, ok bool)

As is a helper function that attempts to extract a target type from the error and returns it. It returns false if the error does not contain the target type.

func Ignore

func Ignore[T any](v T, _ error) T

Ignore is a helper function that returns the first argument and ignores the error.

func Join

func Join(vs ...any) (err error)

Join joins the provided errors or messages into a single error.

func Must

func Must[T any](v T, err error) T

Must is a helper function that panics when the error is not nil. Otherwise, it returns the first argument. It is intended for use with functions that should never return an error when called.

Types

type MultiError

type MultiError []error

MultiError is a collection of errors.

func (MultiError) Error

func (m MultiError) Error() string

Error implements the error interface.

func (MultiError) Unwrap

func (m MultiError) Unwrap() []error

Unwrap unwraps all errors.

Jump to

Keyboard shortcuts

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