flipped the error text around. fixed. (#36)

This commit is contained in:
Scott Nichols 2018-08-02 13:13:38 -07:00 committed by Google Prow Robot
parent c1e9219cee
commit 5182837041
2 changed files with 4 additions and 4 deletions

View File

@ -116,7 +116,7 @@ func ErrInvalidValue(value, fieldPath string) *FieldError {
// not having at least one field in a mutually exclusive field group.
func ErrMissingOneOf(fieldPaths ...string) *FieldError {
return &FieldError{
Message: "expected exactly one, got both",
Message: "expected exactly one, got neither",
Paths: fieldPaths,
}
}
@ -125,7 +125,7 @@ func ErrMissingOneOf(fieldPaths ...string) *FieldError {
// for having more than one field set in a mutually exclusive field group.
func ErrMultipleOneOf(fieldPaths ...string) *FieldError {
return &FieldError{
Message: "expected exactly one, got neither",
Message: "expected exactly one, got both",
Paths: fieldPaths,
}
}

View File

@ -105,12 +105,12 @@ Body.`,
name: "missing mutually exclusive fields",
err: ErrMissingOneOf("foo", "bar"),
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",
err: ErrMultipleOneOf("foo", "bar"),
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",
err: ErrInvalidKeyName("b@r", "foo[0].name",