aicra/internal/dynfunc/errors.go

51 lines
2.2 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 errMissingHandlerContextArgument = cerr("missing handler first argument of type context.Context")
// errMissingHandlerInputArgument - missing params arguments for handler
const errMissingHandlerInputArgument = cerr("missing handler argument: input struct")
2020-04-04 10:46:43 +00:00
// errUnexpectedInput - input argument is not expected
const errUnexpectedInput = cerr("unexpected input struct")
// errMissingHandlerOutputArgument - missing output for handler
const errMissingHandlerOutputArgument = cerr("missing handler first output argument: output struct")
2020-04-04 10:46:43 +00:00
// errMissingHandlerOutputError - missing error output for handler
const errMissingHandlerOutputError = cerr("missing handler last output argument of type api.Err")
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
// errWrongOutputArgumentType - wrong type for output first argument
const errWrongOutputArgumentType = cerr("handler first output argument must be a *struct")
// errMissingConfigArgument - missing an input/output argument in handler struct
const errMissingConfigArgument = cerr("missing an argument from the 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")
// errMissingHandlerErrorArgument - missing handler output error
const errMissingHandlerErrorArgument = cerr("last output must be of type api.Err")