erron

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func Errno

func Errno(err error) int

Errno 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 ...interface{}) 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 ...interface{}) 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.

func WithErrno

func WithErrno(code int, err error) error

WithErrno wraps the error with code

func WithErrnof

func WithErrnof(code int, format string, args ...interface{}) error

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

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 error.

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

Jump to

Keyboard shortcuts

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