errors

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 3 Imported by: 42

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. An error value has a cause if it implements the following interface:

type causer interface {
       Cause() error
}

If the error does not implement Cause, the original error will be returned. If the error is nil, nil will be returned without further investigation.

func Errorf

func Errorf(format string, args ...interface{}) 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 New

func New(message string) error

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

func WithStack

func WithStack(err error) error

WithStack annotates err with a stack trace at the point WithStack was called. If err is nil, WithStack returns nil.

func Wrap

func Wrap(err error, message string) error

Wrap annotates err with a new message. If err is nil, Wrap returns nil.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf annotates err with the format specifier. If err is nil, Wrapf returns nil.

Types

type ErrorList

type ErrorList struct {
	Errors []error
	// contains filtered or unexported fields
}

ErrorList is a wrapper over list of errors It implements error interface

func (*ErrorList) Error

func (el *ErrorList) Error() string

Error is implementation of error interface

func (*ErrorList) Format

func (el *ErrorList) Format(s fmt.State, verb rune)

Format is implementation of Formater interface

func (*ErrorList) WithStack

func (el *ErrorList) WithStack(message string) error

WithStack annotates ErrorList with a new message and stack trace of caller.

func (*ErrorList) WithStackf

func (el *ErrorList) WithStackf(format string, args ...interface{}) error

WithStackf annotates ErrorList with the format specifier and stack trace of caller.

Jump to

Keyboard shortcuts

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