erron

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	EUnknown = -1
	EOK      = 0
)

Variables

This section is empty.

Functions

func AsErrno added in v0.0.18

func AsErrno(err error) error

func Errno

func Errno(code int, err error) error

Errno wraps the error with code

func Errnof added in v0.0.18

func Errnof(code int, format string, args ...any) error

Errnof returns an error that formats as the given text with code.

func GetErrno added in v0.0.18

func GetErrno(err error) int

GetErrno finds the first error in err's chain that contains errno.

The chain consists of err itself followed by the sequence of errors obtained by repeatedly calling Unwrap.

func New

func New(text string, args ...any) error

New returns an error that formats as the given text.

func Throw

func Throw(err error) error

Throw wraps the error with source code position information.

func Throwf

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

Throwf returns an error that formats as the given text with source code position information.

func Try

func Try(fn func() error) (err error)

Try executes the fn, and then recovers any panics as an error. If no panics, return the result of fn.

Types

type Errors

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

Errors is a container for holds errors

func (*Errors) All

func (errs *Errors) All() error

All merges all errors as an error, nil returned if no errors.

func (*Errors) Append

func (errs *Errors) Append(err error)

Append appends err to list if e is non-nil

func (*Errors) First

func (errs *Errors) First() error

First gets the first error of list

func (*Errors) Last

func (errs *Errors) Last() error

Last gets the last error of list

func (Errors) Len added in v0.0.2

func (errs Errors) Len() int

Jump to

Keyboard shortcuts

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