Skip to content

Commit

Permalink
Fix unhelpful error in GetPrimaryKeyField (#208)
Browse files Browse the repository at this point in the history
Description of changes:
Replacing debugging error with more useful message

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
RedbackThomson authored Sep 27, 2021
1 parent 2b0ac06 commit a2234b0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/model/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,11 @@ func (r *CRD) GetPrimaryKeyField() (*Field, error) {

fieldNames := names.New(fieldName)
fPath := fieldNames.Camel
var notFound bool
primaryField, notFound = r.Fields[fPath]
if !notFound {
return nil, fmt.Errorf("what the frick")
var found bool
primaryField, found = r.Fields[fPath]
if !found {
return nil, fmt.Errorf("could not find field with path " + fPath +
" for primary key " + fieldName)
}
}
return primaryField, nil
Expand Down

0 comments on commit a2234b0

Please sign in to comment.