Clean up error logs.
Use %v for errors, tidy some messages, make error messages start lowe-case (as per go guidelines). Just accumulated nits.
This commit is contained in:
@@ -99,7 +99,7 @@ func NewConflict(kind, name string, err error) error {
|
||||
Kind: kind,
|
||||
ID: name,
|
||||
},
|
||||
Message: fmt.Sprintf("%s %q cannot be updated: %s", kind, name, err),
|
||||
Message: fmt.Sprintf("%s %q cannot be updated: %v", kind, name, err),
|
||||
}}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ func NewInvalid(kind, name string, errs ValidationErrorList) error {
|
||||
ID: name,
|
||||
Causes: causes,
|
||||
},
|
||||
Message: fmt.Sprintf("%s %q is invalid: %s", kind, name, errs.ToError()),
|
||||
Message: fmt.Sprintf("%s %q is invalid: %v", kind, name, errs.ToError()),
|
||||
}}
|
||||
}
|
||||
|
||||
|
@@ -294,7 +294,7 @@ func (a genericAccessor) SetSelfLink(selfLink string) {
|
||||
func fieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
field := v.FieldByName(fieldName)
|
||||
if !field.IsValid() {
|
||||
return fmt.Errorf("Couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
|
||||
}
|
||||
v, err := conversion.EnforcePtr(dest)
|
||||
if err != nil {
|
||||
@@ -309,7 +309,7 @@ func fieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
|
||||
v.Set(field.Convert(v.Type()))
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("Couldn't assign/convert %v to %v", field.Type(), v.Type())
|
||||
return fmt.Errorf("couldn't assign/convert %v to %v", field.Type(), v.Type())
|
||||
}
|
||||
|
||||
// extractFromTypeMeta extracts pointers to version and kind fields from an object
|
||||
|
@@ -434,7 +434,7 @@ func ValidateService(service *api.Service, lister ServiceLister, ctx api.Context
|
||||
if services.Items[i].Name != service.Name &&
|
||||
services.Items[i].Spec.CreateExternalLoadBalancer &&
|
||||
services.Items[i].Spec.Port == service.Spec.Port {
|
||||
allErrs = append(allErrs, errs.NewConflict("service", service.Name, fmt.Errorf("Port: %d is already in use", service.Spec.Port)))
|
||||
allErrs = append(allErrs, errs.NewConflict("service", service.Name, fmt.Errorf("port: %d is already in use", service.Spec.Port)))
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -548,7 +548,7 @@ func ValidateMinionUpdate(oldMinion *api.Minion, minion *api.Minion) errs.Valida
|
||||
oldMinion.Labels = minion.Labels
|
||||
oldMinion.ObjectMeta.Labels = minion.ObjectMeta.Labels
|
||||
if !reflect.DeepEqual(oldMinion, minion) {
|
||||
allErrs = append(allErrs, fmt.Errorf("Update contains more than labels changes"))
|
||||
allErrs = append(allErrs, fmt.Errorf("update contains more than labels changes"))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
@@ -805,7 +805,7 @@ func TestValidateService(t *testing.T) {
|
||||
registry.List = tc.existing
|
||||
errs := ValidateService(&tc.svc, registry, api.NewDefaultContext())
|
||||
if len(errs) != tc.numErrs {
|
||||
t.Errorf("Unexpected error list for case %q: %+v", tc.name, errs)
|
||||
t.Errorf("Unexpected error list for case %q: %v", tc.name, errs.ToError())
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user