errors

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Except

func Except(err error, ignore ...error)

Handle error if not nil, and not among ignored ones.

func ExceptFn

func ExceptFn[T any](fn ErrorFn[T], ignore ...error) T

Handle error if not nil, and not among ignored ones. Return anything from fn except for error if successful.

func ExceptFn2

func ExceptFn2[T, U any](fn ErrorFn2[T, U], ignore ...error) (T, U)

Handle error if not nil, and not among ignored ones. Return anything from fn except for error if successful.

func LastError

func LastError() error

Retrieve last error.

func LastErrorWas

func LastErrorWas(err error) bool

Check if last error was of this kind.

func RegisterCallback

func RegisterCallback(fn Callback)

Register custom callback to handle error.

func RestoreCallback

func RestoreCallback()

Reset callback function to fmt.Fprintln(os.Stderr, err).

Types

type Callback

type Callback func(error)

Callback function to handle error.

type ErrorFn

type ErrorFn[T any] func() (T, error)

Function of type func[T any]() (T, error).

func W

func W[T any](t T, err error) ErrorFn[T]

Wrapper for function of type func[T any]() (T, error).

type ErrorFn2

type ErrorFn2[T, U any] func() (T, U, error)

Function of type func[T, U any]() (T, U, error).

func W2

func W2[T, U any](t T, u U, err error) ErrorFn2[T, U]

Wrapper for function of type func[T, U any]() (T, U, error).

Jump to

Keyboard shortcuts

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