2020-04-04 08:36:52 +00:00
|
|
|
package dynfunc
|
2020-03-29 13:00:22 +00:00
|
|
|
|
|
|
|
// 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-03-29 13:00:22 +00:00
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errNoServiceForHandler - no service matching this handler
|
|
|
|
const errNoServiceForHandler = cerr("no service found for this handler")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errMissingHandlerArgumentParam - missing params arguments for handler
|
|
|
|
const errMissingHandlerArgumentParam = cerr("missing handler argument : parameter struct")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errUnexpectedInput - input argument is not expected
|
|
|
|
const errUnexpectedInput = cerr("unexpected input struct")
|
2020-04-04 08:02:48 +00:00
|
|
|
|
2021-04-17 12:03:59 +00:00
|
|
|
// errMissingContext - first input argument is missing
|
|
|
|
const errMissingContext = cerr("missing first input argument (*api.Context)")
|
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errMissingHandlerOutput - missing output for handler
|
|
|
|
const errMissingHandlerOutput = cerr("handler must have at least 1 output")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errMissingHandlerOutputError - missing error output for handler
|
2021-03-28 16:49:23 +00:00
|
|
|
const errMissingHandlerOutputError = cerr("handler must have its last output of type api.Err")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
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-03-29 13:00:22 +00:00
|
|
|
|
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-03-29 13:00:22 +00:00
|
|
|
|
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-03-29 13:00:22 +00:00
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errMissingParamFromConfig - missing a parameter in handler struct
|
|
|
|
const errMissingParamFromConfig = cerr("missing a parameter from configuration")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errMissingOutputFromConfig - missing a parameter in handler struct
|
|
|
|
const errMissingOutputFromConfig = cerr("missing a parameter from configuration")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
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-03-29 13:00:22 +00:00
|
|
|
|
2020-04-04 10:46:43 +00:00
|
|
|
// errMissingHandlerErrorOutput - missing handler output error
|
2021-03-28 16:49:23 +00:00
|
|
|
const errMissingHandlerErrorOutput = cerr("last output must be of type api.Err")
|