Documentation ¶
Index ¶
- Constants
- func Annotate(err error, key, val interface{}) error
- func GetAction(err error, defValue string) string
- func GetStatus(err error, defValue int) int
- func Value(err error, key interface{}) interface{}
- func WithAction(err error, action string) error
- func WithStatus(err error, statusCode int) error
Constants ¶
const HTTPStatusClientClosedRequest = 499
HTTPStatusClientClosedRequest is used when the client closes the request without waiting for the full answer. There's no standard for such status, however, nginx does define a custom one, which is common enough to warrant using it. See https://httpstatuses.com/499.
Variables ¶
This section is empty.
Functions ¶
func Annotate ¶
Annotate returns a new error annotated with the provided key and value. If err is nil, does nothing.
func GetAction ¶
GetAction returns the most recent action annotation on the error. If none is found, defValue is returned instead.
func GetStatus ¶
GetStatus returns the most recent status code annotation on the error. If none is found, defValue is returned instead.
func Value ¶
func Value(err error, key interface{}) interface{}
Value returns the most recent annotation by key on this error.
func WithAction ¶
WithAction annotates an error with an action. If err is nil, does nothing.
func WithStatus ¶
WithStatus annotates an error with a status. If err is nil, does nothing.
Types ¶
This section is empty.