Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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") )
Functions ¶
func IsAlreadyExistError ¶
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
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
PrettyPrintCode renders 'h' as "<error code> <description>", e.g. "200 OK"
Types ¶
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
NewHTTPError returns a new HTTPError where the HTTP error code is 'code' and the error message is based on 'formatStr' and 'args'