Skip to content

Commit

Permalink
Show a friendlier error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ldmberman committed Sep 21, 2015
1 parent 40c44f0 commit f0f6444
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion model_loader/model_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func loadValue(key string, arg interface{}, field reflect.Value) error {
func getFieldByName(model reflect.Value, name string) (reflect.Value, error) {
field := model.Elem().FieldByName(name)
if !field.IsValid() {
return reflect.ValueOf(nil), fmt.Errorf("Field `%s` does not exist.", name)
return reflect.ValueOf(nil), fmt.Errorf("Unknown option or argument: `%s`.", name)
}
return field, nil
}
Expand Down
2 changes: 1 addition & 1 deletion model_loader/model_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ var testCases = []modelLoaderTestCase{
args: map[string]interface{}{
"UnknownField": "some value",
},
err: "Field `UnknownField` does not exist.",
err: "Unknown option or argument: `UnknownField`.",
},
// Fails with different type mismatches.
{
Expand Down

0 comments on commit f0f6444

Please sign in to comment.