2020-04-04 08:36:52 +00:00
|
|
|
package dynfunc
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// Err allows you to create constant "const" error with type boxing.
|
|
|
|
type Err string
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
func (err Err) Error() string {
|
2020-03-29 13:00:22 +00:00
|
|
|
return string(err)
|
|
|
|
}
|
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
const (
|
|
|
|
// ErrHandlerNotFunc - handler is not a func
|
|
|
|
ErrHandlerNotFunc = Err("handler must be a func")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrNoServiceForHandler - no service matching this handler
|
|
|
|
ErrNoServiceForHandler = Err("no service found for this handler")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// errMissingHandlerArgumentParam - missing params arguments for handler
|
|
|
|
ErrMissingHandlerContextArgument = Err("missing handler first argument of type context.Context")
|
2021-06-19 22:47:04 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrMissingHandlerInputArgument - missing params arguments for handler
|
|
|
|
ErrMissingHandlerInputArgument = Err("missing handler argument: input struct")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrUnexpectedInput - input argument is not expected
|
|
|
|
ErrUnexpectedInput = Err("unexpected input struct")
|
2020-04-04 08:02:48 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrMissingHandlerOutputArgument - missing output for handler
|
|
|
|
ErrMissingHandlerOutputArgument = Err("missing handler first output argument: output struct")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrMissingHandlerOutputError - missing error output for handler
|
|
|
|
ErrMissingHandlerOutputError = Err("missing handler last output argument of type api.Err")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrMissingRequestArgument - missing request argument for handler
|
|
|
|
ErrMissingRequestArgument = Err("handler first argument must be of type api.Request")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrMissingParamArgument - missing parameters argument for handler
|
|
|
|
ErrMissingParamArgument = Err("handler second argument must be a struct")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrUnexportedName - argument is unexported in struct
|
|
|
|
ErrUnexportedName = Err("unexported name")
|
2020-03-29 17:13:07 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrWrongOutputArgumentType - wrong type for output first argument
|
|
|
|
ErrWrongOutputArgumentType = Err("handler first output argument must be a *struct")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrMissingConfigArgument - missing an input/output argument in handler struct
|
|
|
|
ErrMissingConfigArgument = Err("missing an argument from the configuration")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrWrongParamTypeFromConfig - a configuration parameter type is invalid in the handler param struct
|
|
|
|
ErrWrongParamTypeFromConfig = Err("invalid struct field type")
|
2020-03-29 13:00:22 +00:00
|
|
|
|
2021-06-20 19:52:11 +00:00
|
|
|
// ErrMissingHandlerErrorArgument - missing handler output error
|
|
|
|
ErrMissingHandlerErrorArgument = Err("last output must be of type api.Err")
|
|
|
|
)
|