Move field errors to pkg/util/fielderrors

Allows pkg/api to take a reference to labels.Selector and fields.Selector
This commit is contained in:
Clayton Coleman
2015-03-22 17:40:47 -04:00
parent ef758881d1
commit 65425f690c
21 changed files with 57 additions and 47 deletions

View File

@@ -22,8 +22,8 @@ import (
"sort"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/fielderrors"
)
// Selector represents a label selector.
@@ -758,14 +758,14 @@ const qualifiedNameErrorMsg string = "must match regex [" + util.DNS1123Subdomai
func validateLabelKey(k string) error {
if !util.IsQualifiedName(k) {
return errors.NewFieldInvalid("label key", k, qualifiedNameErrorMsg)
return fielderrors.NewFieldInvalid("label key", k, qualifiedNameErrorMsg)
}
return nil
}
func validateLabelValue(v string) error {
if !util.IsValidLabelValue(v) {
return errors.NewFieldInvalid("label value", v, qualifiedNameErrorMsg)
return fielderrors.NewFieldInvalid("label value", v, qualifiedNameErrorMsg)
}
return nil
}