mirror of https://github.com/knative/pkg.git
flipped the error text around. fixed. (#36)
This commit is contained in:
parent
c1e9219cee
commit
5182837041
|
@ -116,7 +116,7 @@ func ErrInvalidValue(value, fieldPath string) *FieldError {
|
||||||
// not having at least one field in a mutually exclusive field group.
|
// not having at least one field in a mutually exclusive field group.
|
||||||
func ErrMissingOneOf(fieldPaths ...string) *FieldError {
|
func ErrMissingOneOf(fieldPaths ...string) *FieldError {
|
||||||
return &FieldError{
|
return &FieldError{
|
||||||
Message: "expected exactly one, got both",
|
Message: "expected exactly one, got neither",
|
||||||
Paths: fieldPaths,
|
Paths: fieldPaths,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ func ErrMissingOneOf(fieldPaths ...string) *FieldError {
|
||||||
// for having more than one field set in a mutually exclusive field group.
|
// for having more than one field set in a mutually exclusive field group.
|
||||||
func ErrMultipleOneOf(fieldPaths ...string) *FieldError {
|
func ErrMultipleOneOf(fieldPaths ...string) *FieldError {
|
||||||
return &FieldError{
|
return &FieldError{
|
||||||
Message: "expected exactly one, got neither",
|
Message: "expected exactly one, got both",
|
||||||
Paths: fieldPaths,
|
Paths: fieldPaths,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,12 +105,12 @@ Body.`,
|
||||||
name: "missing mutually exclusive fields",
|
name: "missing mutually exclusive fields",
|
||||||
err: ErrMissingOneOf("foo", "bar"),
|
err: ErrMissingOneOf("foo", "bar"),
|
||||||
prefixes: [][]string{{"baz"}},
|
prefixes: [][]string{{"baz"}},
|
||||||
want: `expected exactly one, got both: baz.foo, baz.bar`,
|
want: `expected exactly one, got neither: baz.foo, baz.bar`,
|
||||||
}, {
|
}, {
|
||||||
name: "multiple mutually exclusive fields",
|
name: "multiple mutually exclusive fields",
|
||||||
err: ErrMultipleOneOf("foo", "bar"),
|
err: ErrMultipleOneOf("foo", "bar"),
|
||||||
prefixes: [][]string{{"baz"}},
|
prefixes: [][]string{{"baz"}},
|
||||||
want: `expected exactly one, got neither: baz.foo, baz.bar`,
|
want: `expected exactly one, got both: baz.foo, baz.bar`,
|
||||||
},{
|
},{
|
||||||
name: "invalid key name",
|
name: "invalid key name",
|
||||||
err: ErrInvalidKeyName("b@r", "foo[0].name",
|
err: ErrInvalidKeyName("b@r", "foo[0].name",
|
||||||
|
|
Loading…
Reference in New Issue