Documentation
¶
Overview ¶
Package errors provides simple error stack and a little more of context to the error
Normally you would compose your error doing something like this
response, err := doSomething(somethingID)
if err != nil {
return fmt.Errorf(
"my error with id %d, response \"%v\"; %v",
somethingID,
response,
err,
)
}
All the context from your error will have to be in the error string. After yout would need to extract all context from the string above.
What this package do is add arguments to your error;
response, err := doSomething(somethingID)
if err != nil {
return errors.New("my error").
SetParent(err).
SetArg("somethingID", somethingID).
SetArg("response", response)
}
fmt.Println(err) // "something err; my error"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.