test dynfunc package; standardize and refactor api #14

Merged
xdrm-brackets merged 19 commits from test/dynamic into 0.3.0 2020-04-04 10:09:20 +00:00
2 changed files with 2 additions and 6 deletions
Showing only changes of commit 438e308f71 - Show all commits

View File

@ -29,7 +29,7 @@ const ErrMissingRequestArgument = cerr("handler first argument must be of type a
// ErrMissingParamArgument - missing parameters argument for handler // ErrMissingParamArgument - missing parameters argument for handler
const ErrMissingParamArgument = cerr("handler second argument must be a struct") 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") const ErrUnexportedName = cerr("unexported name")
// ErrMissingParamOutput - missing output argument for handler // 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 // ErrWrongParamTypeFromConfig - a configuration parameter type is invalid in the handler param struct
const ErrWrongParamTypeFromConfig = cerr("invalid struct field type") 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 // ErrMissingHandlerErrorOutput - missing handler output error
const ErrMissingHandlerErrorOutput = cerr("last output must be of type api.Error") const ErrMissingHandlerErrorOutput = cerr("last output must be of type api.Error")

View File

@ -125,8 +125,7 @@ func (s spec) checkOutput(fnv reflect.Value) error {
continue continue
} }
if !ptype.ConvertibleTo(field.Type) { return fmt.Errorf("%s: %w (%s instead of %s)", name, ErrWrongParamTypeFromConfig, field.Type, ptype)
return fmt.Errorf("%s: %w (%s instead of %s)", name, ErrWrongOutputTypeFromConfig, field.Type, ptype)
} }
} }