merge duplicate errors

This commit is contained in:
Adrien Marquès 2020-03-29 19:22:43 +02:00
parent 7e42c1b6d9
commit 438e308f71
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
2 changed files with 2 additions and 6 deletions

View File

@ -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")

View File

@ -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)
}
}