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 = errors.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 IsInvalidPathError Uses

func IsInvalidPathError(err error) bool

IsInvalidPathError returns true if the err is due to an invalid path

func IsNotADirectoryError Uses

func IsNotADirectoryError(err error) bool

IsNotADirectoryError returns true if the err is due to an attempt to put a file on path that has a non-directory parent. These errors come from the hashtree package; while it provides an error code, we can't check against that because we'd then have to import hashtree, and hashtree imports errutil, leading to circular imports.

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 IsWriteToOutputBranchError Uses

func IsWriteToOutputBranchError(err error) bool

IsWriteToOutputBranchError returns true if the err is due to an attempt to write to an output repo/branch

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 4 packages (graph) and is imported by 20 packages. Updated 2020-07-15. Refresh now. Tools for package owners.