diff --git a/dynamic/errors.go b/dynamic/errors.go index 891f254..f8260c3 100644 --- a/dynamic/errors.go +++ b/dynamic/errors.go @@ -29,7 +29,7 @@ const ErrMissingRequestArgument = cerr("handler first argument must be of type a // ErrMissingParamArgument - missing parameters argument for handler const ErrMissingParamArgument = cerr("handler second argument must be a struct") -// ErrUnexportedParamName - argument is unexported in struct +// ErrUnexportedName - argument is unexported in struct const ErrUnexportedName = cerr("unexported name") // ErrMissingParamOutput - missing output argument for handler @@ -44,8 +44,5 @@ const ErrMissingOutputFromConfig = cerr("missing a parameter from configuration" // ErrWrongParamTypeFromConfig - a configuration parameter type is invalid in the handler param struct const ErrWrongParamTypeFromConfig = cerr("invalid struct field type") -// ErrWrongOutputTypeFromConfig - a configuration output type is invalid in the handler output struct -const ErrWrongOutputTypeFromConfig = cerr("invalid struct field type") - // ErrMissingHandlerErrorOutput - missing handler output error const ErrMissingHandlerErrorOutput = cerr("last output must be of type api.Error") diff --git a/dynamic/spec.go b/dynamic/spec.go index 83c6dd0..d5fa04b 100644 --- a/dynamic/spec.go +++ b/dynamic/spec.go @@ -125,8 +125,7 @@ func (s spec) checkOutput(fnv reflect.Value) error { continue } - if !ptype.ConvertibleTo(field.Type) { - return fmt.Errorf("%s: %w (%s instead of %s)", name, ErrWrongOutputTypeFromConfig, field.Type, ptype) + return fmt.Errorf("%s: %w (%s instead of %s)", name, ErrWrongParamTypeFromConfig, field.Type, ptype) } }