aicra/internal/config/errors.go

60 lines
2.4 KiB
Go
Raw Normal View History

package config
// cerr allows you to create constant "const" error with type boxing.
type cerr string
func (err cerr) Error() string {
return string(err)
}
2020-04-04 12:34:20 +00:00
// errRead - a problem ocurred when trying to read the configuration file
const errRead = cerr("cannot read config")
2020-04-04 12:34:20 +00:00
// errUnknownMethod - invalid http method
const errUnknownMethod = cerr("unknown HTTP method")
2020-04-04 12:34:20 +00:00
// errFormat - a invalid format has been detected
const errFormat = cerr("invalid config format")
2020-04-04 12:34:20 +00:00
// errPatternCollision - there is a collision between 2 services' patterns (same method)
const errPatternCollision = cerr("pattern collision")
2020-04-04 12:34:20 +00:00
// errInvalidPattern - a service pattern is malformed
const errInvalidPattern = cerr("must begin with a '/' and not end with")
2020-04-04 12:34:20 +00:00
// errInvalidPatternBraceCapture - a service pattern brace capture is invalid
const errInvalidPatternBraceCapture = cerr("invalid uri capturing braces")
2020-04-04 12:34:20 +00:00
// errUnspecifiedBraceCapture - a parameter brace capture is not specified in the pattern
const errUnspecifiedBraceCapture = cerr("capturing brace missing in the path")
2020-04-04 12:34:20 +00:00
// errMandatoryRename - capture/query parameters must have a rename
const errMandatoryRename = cerr("capture and query parameters must have a 'name'")
2020-04-04 12:34:20 +00:00
// errUndefinedBraceCapture - a parameter brace capture in the pattern is not defined in parameters
const errUndefinedBraceCapture = cerr("capturing brace missing input definition")
2020-04-04 12:34:20 +00:00
// errMissingDescription - a service is missing its description
const errMissingDescription = cerr("missing description")
2020-04-04 12:34:20 +00:00
// errIllegalOptionalURIParam - an URI parameter cannot be optional
const errIllegalOptionalURIParam = cerr("URI parameter cannot be optional")
2020-04-04 12:34:20 +00:00
// errOptionalOption - an output is optional
const errOptionalOption = cerr("output cannot be optional")
2020-04-04 12:34:20 +00:00
// errMissingParamDesc - a parameter is missing its description
const errMissingParamDesc = cerr("missing parameter description")
2020-04-04 12:34:20 +00:00
// errUnknownDataType - a parameter has an unknown datatype name
const errUnknownDataType = cerr("unknown data type")
2020-04-04 12:34:20 +00:00
// errIllegalParamName - a parameter has an illegal name
const errIllegalParamName = cerr("illegal parameter name")
2020-04-04 12:34:20 +00:00
// errMissingParamType - a parameter has an illegal type
const errMissingParamType = cerr("missing parameter type")
2020-04-04 12:34:20 +00:00
// errParamNameConflict - a parameter has a conflict with its name/rename field
const errParamNameConflict = cerr("name conflict for parameter")