26 lines
1.1 KiB
Go
26 lines
1.1 KiB
Go
package db
|
|||
|
|
|
||
|
|
import "errors"
|
||
|
|
|
||
|
|
// Sentinel errors returned by the dynamic-config and IP-queue admin
|
||
|
|
// mutations. Callers (internal/httpapi) map these to HTTP status codes via
|
||
|
|
// errors.Is rather than defaulting everything to 500.
|
||
|
|
var (
|
||
|
|
// ErrNotFound: the referenced entity does not exist.
|
||
|
|
ErrNotFound = errors.New("not found")
|
||
|
|
// ErrConflict: the entity already exists, or a unique slot/key is
|
||
|
|
// already taken by something else.
|
||
|
|
ErrConflict = errors.New("conflict")
|
||
|
|
// ErrBusy: the entity can't be removed because it's currently in use
|
||
|
|
// (e.g. a validator that owns an in-progress IP).
|
||
|
|
ErrBusy = errors.New("busy")
|
||
|
|
// ErrInUse: the entity can't be removed because something else
|
||
|
|
// references it (e.g. a target group referenced by a check type).
|
||
|
|
ErrInUse = errors.New("in use")
|
||
|
|
// ErrValidation: the request is well-formed but refers to something
|
||
|
|
// invalid (e.g. a check type naming a target group that doesn't exist).
|
||
|
|
ErrValidation = errors.New("validation failed")
|
||
|
|
// ErrInvalidState: the requested state transition isn't valid from the
|
||
|
|
// entity's current state (e.g. cancelling an already-finished IP).
|
||
|
|
ErrInvalidState = errors.New("invalid state")
|
||
|
|
)
|