errors

package
v0.0.0-...-a37c5e5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompositeError

type CompositeError struct {
	Errors  []error
	Code    int32
	Message string
}

CompositeError is an error that groups several errors together

func CompositeValidationError

func CompositeValidationError(errors ...error) *CompositeError

CompositeValidationError an error to wrap a bunch of other errors

func (*CompositeError) Error

func (c *CompositeError) Error() string

type Validation

type Validation struct {
	Code    int32
	Name    string
	In      string
	Value   interface{}
	Message string
	Values  []interface{}
}

Validation represents a failure of a precondition

func AdditionalItemsNotAllowed

func AdditionalItemsNotAllowed(name, in string) *Validation

AdditionalItemsNotAllowed an error for invalid additional items

func DuplicateItems

func DuplicateItems(name, in string) *Validation

DuplicateItems error for when an array contains duplicates

func EnumFail

func EnumFail(name, in string, value interface{}, values []interface{}) *Validation

EnumFail error for when an enum validation fails

func ExceedsMaximum

func ExceedsMaximum(name, in string, max float64, exclusive bool) *Validation

ExceedsMaximum error for when maxinum validation fails

func ExceedsMinimum

func ExceedsMinimum(name, in string, min float64, exclusive bool) *Validation

ExceedsMinimum error for when maxinum validation fails

func FailedAllPatternProperties

func FailedAllPatternProperties(name, in, key string) *Validation

FailedAllPatternProperties an error for when the property doesn't match a pattern

func FailedPattern

func FailedPattern(name, in, pattern string) *Validation

FailedPattern error for when a string fails a regex pattern match the pattern that is returned is the ECMA syntax version of the pattern not the golang version.

func InvalidCollectionFormat

func InvalidCollectionFormat(name, in, format string) *Validation

InvalidCollectionFormat another flavor of invalid type error

func InvalidContentType

func InvalidContentType(value string, allowed []string) *Validation

InvalidContentType error for an invalid content type

func InvalidResponseFormat

func InvalidResponseFormat(value string, allowed []string) *Validation

InvalidResponseFormat error for an unacceptable response format request

func InvalidType

func InvalidType(name, in, typeName string, value interface{}) *Validation

InvalidType creates an error for when the type is invalid

func InvalidTypeName

func InvalidTypeName(typeName string) *Validation

InvalidTypeName an error for when the type is invalid

func NotMultipleOf

func NotMultipleOf(name, in string, multiple float64) *Validation

NotMultipleOf error for when multiple of validation fails

func PropertyNotAllowed

func PropertyNotAllowed(name, in, key string) *Validation

PropertyNotAllowed an error for when the property doesn't match a pattern

func Required

func Required(name, in string) *Validation

Required error for when a value is missing

func TooFewItems

func TooFewItems(name, in string, min int64) *Validation

TooFewItems error for when an array contains too few items

func TooFewProperties

func TooFewProperties(name, in string, n int64) *Validation

TooFewProperties an error for an object with too few properties

func TooLong

func TooLong(name, in string, max int64) *Validation

TooLong error for when a string is too long

func TooManyItems

func TooManyItems(name, in string, max int64) *Validation

TooManyItems error for when an array contains too many items

func TooManyProperties

func TooManyProperties(name, in string, n int64) *Validation

TooManyProperties an error for an object with too many properties

func TooShort

func TooShort(name, in string, min int64) *Validation

TooShort error for when a string is too short

func (*Validation) Error

func (e *Validation) Error() string

Jump to

Keyboard shortcuts

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