errdata

package
v1.89.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
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

func Annotate(err error, key, val interface{}) error

Annotate returns a new error annotated with the provided key and value. If err is nil, does nothing.

func GetAction

func GetAction(err error, defValue string) string

GetAction returns the most recent action annotation on the error. If none is found, defValue is returned instead.

func GetStatus

func GetStatus(err error, defValue int) int

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

func WithAction(err error, action string) error

WithAction annotates an error with an action. If err is nil, does nothing.

func WithStatus

func WithStatus(err error, statusCode int) error

WithStatus annotates an error with a status. If err is nil, does nothing.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL