Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDetails ¶
AddDetails adds details to an existing apiError, but keeps the type and handling. If the error is not an apiError, it will wrap the error with the details.
func HTTPResponseFromError ¶
func HTTPResponseFromError(err error) (*httpgrpc.HTTPResponse, bool)
HTTPResponseFromError converts an APIError into a JSON HTTP response
func IsAPIError ¶
IsAPIError returns true if the error provided is an apiError. This implies that HTTPResponseFromError will succeed.
func IsNonRetryableAPIError ¶
IsNonRetryableAPIError returns true if err is an apiError which should be failed and not retried.
Types ¶
type APIError ¶
func (*APIError) EncodeJSON ¶
func (*APIError) StatusCode ¶
adapted from https://github.com/prometheus/prometheus/blob/fdbc40a9efcc8197a94f23f0e479b0b56e52d424/web/api/v1/api.go#L1508-L1521
type Type ¶
type Type string
const ( TypeNone Type = "" TypeTimeout Type = "timeout" TypeCanceled Type = "canceled" TypeExec Type = "execution" TypeBadData Type = "bad_data" TypeInternal Type = "internal" TypeNotFound Type = "not_found" TypeTooManyRequests Type = "too_many_requests" TypeTooLargeEntry Type = "too_large_entry" TypeNotAcceptable Type = "not_acceptable" )
adapted from https://github.com/prometheus/prometheus/blob/fdbc40a9efcc8197a94f23f0e479b0b56e52d424/web/api/v1/api.go#L67-L76