Wrap validation error instead of recreating

Signed-off-by: Simon Croome <simon.croome@storageos.com>
pull/9416/head
Simon Croome 4 years ago
parent 54de1c1f25
commit 6c82c83b3a
No known key found for this signature in database
GPG Key ID: AD35B1845B04F4B6

@ -215,7 +215,7 @@ func validateMetadataName(obj *K8sYamlStruct) error {
allErrs = append(allErrs, field.Invalid(field.NewPath("metadata").Child("name"), obj.Metadata.Name, msg))
}
if len(allErrs) > 0 {
return fmt.Errorf("object name does not conform to Kubernetes naming requirements: %q (%s)", obj.Metadata.Name, allErrs.ToAggregate().Error())
return errors.Wrapf(allErrs.ToAggregate(), "object name does not conform to Kubernetes naming requirements: %q", obj.Metadata.Name)
}
return nil
}

Loading…
Cancel
Save