error

package
v0.0.0-...-0d876fd Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPResponseFromError

func HTTPResponseFromError(err error) (*httpgrpc.HTTPResponse, bool)

HTTPResponseFromError converts an apiError into a JSON HTTP response

func IsAPIError

func IsAPIError(err error) bool

IsAPIError returns true if the error provided is an apiError. This implies that HTTPResponseFromError will succeed.

func IsNonRetryableAPIError

func IsNonRetryableAPIError(err error) bool

IsNonRetryableAPIError returns true if err is an apiError which should be failed and not retried.

func New

func New(typ Type, msg string) error

New creates a new apiError with a static string message

func Newf

func Newf(typ Type, tmpl string, args ...interface{}) error

Newf creates a new apiError with a formatted message

Types

type Type

type Type string
const (
	TypeNone            Type = ""
	TypeTimeout         Type = "timeout"
	TypeCanceled        Type = "canceled"
	TypeExec            Type = "execution"
	TypeBadData         Type = "bad_data"
	TypeInternal        Type = "internal"
	TypeUnavailable     Type = "unavailable"
	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

Jump to

Keyboard shortcuts

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