Documentation ¶
Index ¶
- func Internal(err error) error
- func Invalid(name string, value interface{}) error
- func NewError(typ ErrorType, detail string) error
- func Noninteractive(op string) error
- func NotImplemented() error
- func Range(name string, value interface{}) error
- func Required(name string) error
- func RequiredAnd(names ...string) error
- func RequiredOr(names ...string) error
- func RequiredXor(names ...string) error
- type Error
- type ErrorGroup
- type ErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Internal ¶
Internal generates an instance representing an error that occurs when an internal error is thrown during the command execution.
func Invalid ¶
Invalid generates an instance representing an error that occurs when a string parameter is set a malformed value (e.g. failed regex match, too long).
func Noninteractive ¶ added in v0.0.6
Noninteractive generates an instance representing an error that occurs when a command cannot run in non-interactive mode.
func NotImplemented ¶
func NotImplemented() error
NotImplemented generates an instance representing an error that occurs when an unimplemented method is called.
func Range ¶
Range generates an instance representing an error that occurs when a numeric parameter is outside of its valid range.
func Required ¶
Required generates an instance representing an error that occurs when a required parameter is missing.
func RequiredAnd ¶ added in v0.0.16
RequiredAnd generates an instance representing an error that occurs when all parameters must appear together. And defines an all-or-nothing relationship between parameters where if one of the peers is present, all of them are required as well.
func RequiredOr ¶ added in v0.0.16
RequiredOr generates an instance representing an error that occurs when at least one parameter must appear. Or defines a relationship between parameters where one of the peers is required (and more than one is allowed).
func RequiredXor ¶ added in v0.0.16
RequiredXor generates an instance representing an error that occurs when exclusive parameters must not appear together but where one of them is required. Or defines an exclusive relationship between a set of parameters where one of them is required but not at the same time.
Types ¶
type Error ¶
type Error struct { // Type defines an error type, expressed as a string value. Type ErrorType `json:"type"` // Detail defines a human-readable explanation specific to the error. Detail string `json:"detail"` }
Error provides a way to return detailed information for an error.
type ErrorGroup ¶ added in v0.0.10
type ErrorGroup struct {
// contains filtered or unexported fields
}
ErrorGroup is an error type to track multiple errors. This is used to accumulate errors in cases and return them as a single error.
func NewErrorGroup ¶ added in v0.0.10
func NewErrorGroup() *ErrorGroup
NewErrorGroup returns a new error group.
func (*ErrorGroup) Add ¶ added in v0.0.10
func (e *ErrorGroup) Add(err error)
Add adds a new error to the group.
func (*ErrorGroup) Error ¶ added in v0.0.10
func (e *ErrorGroup) Error() string
Error implements the internal error interface.
func (*ErrorGroup) Errors ¶ added in v0.0.10
func (e *ErrorGroup) Errors() []error
Errors returns the list of errors that this group is wrapping.
func (*ErrorGroup) Len ¶ added in v0.0.10
func (e *ErrorGroup) Len() int
Len implements sort.Interface function for length.
func (*ErrorGroup) Less ¶ added in v0.0.10
func (e *ErrorGroup) Less(i, j int) bool
Less implements sort.Interface function for determining order.
func (*ErrorGroup) Swap ¶ added in v0.0.10
func (e *ErrorGroup) Swap(i, j int)
Swap implements sort.Interface function for swapping elements.
type ErrorType ¶
type ErrorType string
ErrorType represents the type of an error.
const ( // ErrorTypeInternal is used to represent an error that occurs when an internal // error is thrown during the command execution. ErrorTypeInternal ErrorType = "InternalError" // ErrorTypeRequired is used to represent an error that occurs when a required // parameter is missing. ErrorTypeRequired ErrorType = "RequiredError" // ErrorTypeInvalid is used to represent an error that occurs when a string // parameter is set a malformed value (e.g. failed regex match, too long). ErrorTypeInvalid ErrorType = "InvalidError" // ErrorTypeRange is used to represent an error that occurs when a numeric // parameter is outside of its valid range. ErrorTypeRange ErrorType = "RangeError" // ErrorTypeNotImplemented is used to represent an error that occurs when // an unimplemented method is called. ErrorTypeNotImplemented ErrorType = "NotImplementedError" )