Documentation ¶
Overview ¶
Package errors wraps pkg/errors and includes some custom features such as error codes.
Index ¶
- func As(err error, target interface{}) bool
- func Cause(err error) error
- func Errorf(format string, args ...interface{}) error
- func Is(err error, target Code) bool
- func MarshalJSON(err error) string
- func New(code Code, message string) error
- func UnmarshalJSON(r io.Reader) error
- func Unwrap(err error) 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, fmt string, args ...interface{}) error
- type Code
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Is ¶
Is is a fork of the Is() method from `pkg/errors` which takes as its target an error Code instead of an error.
func MarshalJSON ¶ added in v3.33.0
MarshalJSON returns the provided error as a json object (as a string) representing a codedError. If err is not already a codedError, the json object will still represent a codedError but its `code` value will be empty. Note: an empty code here is intentional and is different from code `errors.Uncoded` which is a valid code; it just means the developer returned a codedError but didn't bother to choose (or create) a useful error code.
func UnmarshalJSON ¶ added in v3.33.0
UnmarshalJSON converts the byte slice into a codedError. If the bytes can't unmarshal to a codedError, a normal error will be returned containing the string value of the byte slice.