Documentation ¶
Index ¶
- func Cause(err error) error
- func Errorf(format string, args ...interface{}) error
- func New(message string) error
- func Unpack(err error) []error
- func WithField(err error, key string, value interface{}) error
- func WithFields(err error, fields Fields) error
- func WithMessage(err error, message string) error
- func WithMessagef(err error, format string, args ...interface{}) error
- func WithStack(err error) error
- func Wrap(err error, message string) error
- func Wrapf(err error, format string, args ...interface{}) error
- type Error
- type Fields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cause ¶
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 ¶
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 ¶
New returns an error with the supplied message. New also records the stack trace at the point it was called.
func Unpack ¶
Unpack returns a slice of all the underlying errors, if possible. An error value has a cause if it implements the following interface:
type causer interface { Cause() error }
If the error is nil, an empty slice will be returned.
func WithField ¶
WithField annotates err with the specified field. If err is nil, WithFields returns nil.
func WithFields ¶
WithFields annotates err with fields. If err is nil, WithFields returns nil.
func WithMessage ¶
WithMessage annotates err with a new message. If err is nil, WithMessage returns nil.
func WithMessagef ¶
WithMessagef annotates err with the format specifier. If err is nil, WithMessagef returns nil.
func WithStack ¶
WithStack annotates err with a stack trace at the point WithStack was called. If err is nil, WithStack returns nil.