errutil

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPError

func HTTPError(ctx context.Context, w http.ResponseWriter, err error) bool

HTTPError will respond in a standard way when err != nil. If err is nil, false is returned, true otherwise.

func IsLimitError added in v0.24.0

func IsLimitError(err error) bool

IsLimitError will determine if an error's cause is a limit.Error.

func MapDBError

func MapDBError(err error) error

MapDBError will map known DB errors (like unique names) to a valiation error

func ScrubError

func ScrubError(err error) (bool, error)

ScrubError will replace an err with a generic one if it is not a validation error. The boolean value indicates if the error was scrubbed (replaced with a safe one).

Types

type LimitError added in v0.24.0

type LimitError interface {
	error
	Max() int
	ID() limit.ID
	Limit() bool
}

LimitError represents an error caused by a configured system limit.

type SafeError

type SafeError string

SafeError is an error string, safe to return to the client.

func (SafeError) ClientError

func (SafeError) ClientError() bool

ClientError always returns true.

func (SafeError) Error

func (err SafeError) Error() string

Jump to

Keyboard shortcuts

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