merge duplicate errors
This commit is contained in:
parent
7e42c1b6d9
commit
438e308f71
|
@ -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")
|
||||||
|
|
|
@ -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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue