pachyderm: github.com/pachyderm/pachyderm/src/server/pkg/errutil Index | Files

package errutil

import "github.com/pachyderm/pachyderm/src/server/pkg/errutil"

Index

Package Files

errutil.go http.go

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")
)

func IsAlreadyExistError Uses

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 Uses

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 Uses

func PrettyPrintCode(h *HTTPError) string

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

type HTTPError Uses

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 Uses

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 Uses

func (h *HTTPError) Code() int

Code returns the HTTP error code associated with 'h'

func (*HTTPError) Error Uses

func (h *HTTPError) Error() string

Package errutil imports 3 packages (graph) and is imported by 16 packages. Updated 2019-01-29. Refresh now. Tools for package owners.