aicra/internal/dynfunc/errors.go

51 lines
2.1 KiB
Go
Raw Normal View History

package dynfunc
// 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 10:46:43 +00:00
// errHandlerNotFunc - handler is not a func
const errHandlerNotFunc = cerr("handler must be a func")
2020-04-04 10:46:43 +00:00
// errNoServiceForHandler - no service matching this handler
const errNoServiceForHandler = cerr("no service found for this handler")
2020-04-04 10:46:43 +00:00
// errMissingHandlerArgumentParam - missing params arguments for handler
const errMissingHandlerArgumentParam = cerr("missing handler argument : parameter struct")
2020-04-04 10:46:43 +00:00
// errUnexpectedInput - input argument is not expected
const errUnexpectedInput = cerr("unexpected input struct")
2020-04-04 10:46:43 +00:00
// errMissingHandlerOutput - missing output for handler
const errMissingHandlerOutput = cerr("handler must have at least 1 output")
2020-04-04 10:46:43 +00:00
// errMissingHandlerOutputError - missing error output for handler
const errMissingHandlerOutputError = cerr("handler must have its last output of type api.Error")
2020-04-04 10:46:43 +00:00
// errMissingRequestArgument - missing request argument for handler
const errMissingRequestArgument = cerr("handler first argument must be of type api.Request")
2020-04-04 10:46:43 +00:00
// errMissingParamArgument - missing parameters argument for handler
const errMissingParamArgument = cerr("handler second argument must be a struct")
2020-04-04 10:46:43 +00:00
// errUnexportedName - argument is unexported in struct
const errUnexportedName = cerr("unexported name")
2020-03-29 17:13:07 +00:00
2020-04-04 10:46:43 +00:00
// errMissingParamOutput - missing output argument for handler
const errMissingParamOutput = cerr("handler first output must be a *struct")
2020-04-04 10:46:43 +00:00
// errMissingParamFromConfig - missing a parameter in handler struct
const errMissingParamFromConfig = cerr("missing a parameter from configuration")
2020-04-04 10:46:43 +00:00
// errMissingOutputFromConfig - missing a parameter in handler struct
const errMissingOutputFromConfig = cerr("missing a parameter from configuration")
2020-04-04 10:46:43 +00:00
// errWrongParamTypeFromConfig - a configuration parameter type is invalid in the handler param struct
const errWrongParamTypeFromConfig = cerr("invalid struct field type")
2020-04-04 10:46:43 +00:00
// errMissingHandlerErrorOutput - missing handler output error
const errMissingHandlerErrorOutput = cerr("last output must be of type api.Error")