Version: v1.8.1 Latest Latest

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

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 3 Imported by: 0




This section is empty.


View Source
var (
	// ErrBreak is an error used to break out of call back based iteration,
	// should be swallowed by iteration functions and treated as successful
	// iteration.
	ErrBreak = fmt.Errorf("BREAK")


func IsAlreadyExistError

func IsAlreadyExistError(err error) bool

IsAlreadyExistError returns true if err is due to trying to create a resource that already exists. It uses simple string matching, it's not terribly smart.

func IsNotFoundError added in v1.7.0

func IsNotFoundError(err error) bool

IsNotFoundError returns true if err is due to a resource not being found. It uses simple string matching, it's not terribly smart.

func PrettyPrintCode added in v1.7.11

func PrettyPrintCode(h *HTTPError) string

PrettyPrintCode renders 'h' as "<error code> <description>", e.g. "200 OK"


type HTTPError added in v1.7.11

type HTTPError struct {
	// contains filtered or unexported fields

HTTPError is an error that extends the built-in 'error' with an HTTP error code. This is useful for functions that implement the core functionality of HTTP endpoints (and therefore specify the error type) but not logging, etc, which would be in the 'func(http.ResponseWriter, *http.Request)' handler.

func NewHTTPError added in v1.7.11

func NewHTTPError(code int, formatStr string, args ...interface{}) *HTTPError

NewHTTPError returns a new HTTPError where the HTTP error code is 'code' and the error message is based on 'formatStr' and 'args'

func (*HTTPError) Code added in v1.7.11

func (h *HTTPError) Code() int

Code returns the HTTP error code associated with 'h'

func (*HTTPError) Error added in v1.7.11

func (h *HTTPError) Error() string

Source Files

Jump to

Keyboard shortcuts

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