Documentation
¶
Overview ¶
Package errtag provides a way to add tags to errors.
Example ¶
err := errbase.New("error")
err = Wrap(err, "foo", "bar")
tags := Get(err)
fmt.Println(tags["foo"])
Output: bar
Index ¶
- func All(err error) iter.Seq2[string, string]
- func Get(err error) map[string]string
- func Wrap(err error, key string, val string) error
- func WrapBool(err error, key string, value bool) error
- func WrapFloat64(err error, key string, value float64) error
- func WrapInt(err error, key string, value int) error
- func WrapInt64(err error, key string, value int64) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wrap ¶
Wrap adds a tag to an error.
Tags should be use for short and simple values, such as identifiers.
The verbose message is "tag <key> = <val>".
func WrapFloat64 ¶
WrapFloat64 is a helper for Wrap with float64 value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.