Documentation ¶
Overview ¶
The errors package defines common error types which are used across the prompting subsystems, along with constructors for specific errors based on those broader types.
Index ¶
- Variables
- type ParseError
- type RequestedPathNotMatchedError
- type RequestedPermissionsNotMatchedError
- type RuleConflict
- type RuleConflictError
- type UnsupportedValueError
- func NewInvalidInterfaceError(unsupported string, supported []string) *UnsupportedValueError
- func NewInvalidLifespanError(unsupported string, supported []string) *UnsupportedValueError
- func NewInvalidOutcomeError(unsupported string, supported []string) *UnsupportedValueError
- func NewInvalidPermissionsError(iface string, unsupported []string, supported []string) *UnsupportedValueError
- func NewPermissionsListEmptyError(iface string, supported []string) *UnsupportedValueError
- func NewRuleLifespanSingleError(supported []string) *UnsupportedValueError
Constants ¶
This section is empty.
Variables ¶
var ( // NotFound errors when a prompt or rule is not found ErrPromptNotFound = errors.New("cannot find prompt with the given ID for the given user") ErrRuleNotFound = errors.New("cannot find rule with the given ID") ErrRuleNotAllowed = errors.New("user not allowed to request the rule with the given ID") // Validation errors, which should never be used directly apart from // checking errors.Is(), and should otherwise always be wrapped in // dedicated error types defined below. ErrReplyNotMatchRequestedPath = errors.New("path pattern in reply constraints does not match originally requested path") ErrReplyNotMatchRequestedPermissions = errors.New("permissions in reply constraints do not include all requested permissions") ErrRuleConflict = errors.New("a rule with conflicting path pattern and permission already exists in the rule database") // Internal errors which are not handled specifically ErrPromptsClosed = errors.New("prompts backend has already been closed") ErrRulesClosed = errors.New("rules backend has already been closed") ErrTooManyPrompts = errors.New("cannot add new prompts, too many outstanding") ErrRuleIDConflict = errors.New("internal error: rule with conflicting ID already exists in the rule database") ErrRuleDBInconsistent = errors.New("internal error: interfaces requests rule database left inconsistent") // Errors which are used internally and should never be returned over the API ErrNoMatchingRule = errors.New("no rule matches the given path") ErrInvalidID = errors.New("invalid ID: format must be parsable as uint64") ErrRuleExpirationInThePast = errors.New("cannot have expiration time in the past") )
var ErrParseError = errors.New("parse error")
Marker for ParseError, should never be returned as an actual error value.
var ErrUnsupportedValue = errors.New("unsupported value")
Marker for UnsupportedValueError, should never be returned as an actual error value.
Functions ¶
This section is empty.
Types ¶
type ParseError ¶
ParseError is a wrapper for errors about a field whose value is malformed.
func NewInvalidDurationError ¶
func NewInvalidDurationError(invalid string, reason string) *ParseError
func NewInvalidExpirationError ¶
func NewInvalidExpirationError(invalid time.Time, reason string) *ParseError
func NewInvalidPathPatternError ¶
func NewInvalidPathPatternError(invalid string, reason string) *ParseError
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error
type RequestedPathNotMatchedError ¶
RequestedPathNotMatchedError stores a path pattern from a reply which doesn't match the requested path.
func (*RequestedPathNotMatchedError) Error ¶
func (e *RequestedPathNotMatchedError) Error() string
func (*RequestedPathNotMatchedError) Unwrap ¶
func (e *RequestedPathNotMatchedError) Unwrap() error
type RequestedPermissionsNotMatchedError ¶
RequestedPermissionsNotMatchedError stores the list of permissions from a reply which doesn't include all the requested permissions.
func (*RequestedPermissionsNotMatchedError) Error ¶
func (e *RequestedPermissionsNotMatchedError) Error() string
func (*RequestedPermissionsNotMatchedError) Unwrap ¶
func (e *RequestedPermissionsNotMatchedError) Unwrap() error
type RuleConflict ¶
RuleConflict stores the permission and rendered variant which conflicted with that of another rule, along with the ID of that conflicting rule.
type RuleConflictError ¶
type RuleConflictError struct {
Conflicts []RuleConflict
}
RuleConflictError stores a list of conflicts with existing rules which occurred when attempting to add or patch a rule.
func (*RuleConflictError) Error ¶
func (e *RuleConflictError) Error() string
func (*RuleConflictError) Unwrap ¶
func (e *RuleConflictError) Unwrap() error
type UnsupportedValueError ¶
UnsupportedValueError is a wrapper for errors about a field having an unsupported value when there is a fixed set of supported values.
func NewInvalidInterfaceError ¶
func NewInvalidInterfaceError(unsupported string, supported []string) *UnsupportedValueError
func NewInvalidLifespanError ¶
func NewInvalidLifespanError(unsupported string, supported []string) *UnsupportedValueError
func NewInvalidOutcomeError ¶
func NewInvalidOutcomeError(unsupported string, supported []string) *UnsupportedValueError
func NewInvalidPermissionsError ¶
func NewInvalidPermissionsError(iface string, unsupported []string, supported []string) *UnsupportedValueError
func NewPermissionsListEmptyError ¶
func NewPermissionsListEmptyError(iface string, supported []string) *UnsupportedValueError
func NewRuleLifespanSingleError ¶
func NewRuleLifespanSingleError(supported []string) *UnsupportedValueError
func (*UnsupportedValueError) Error ¶
func (e *UnsupportedValueError) Error() string
func (*UnsupportedValueError) Is ¶
func (e *UnsupportedValueError) Is(target error) bool