Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
fixup ConvertFromModel function
Browse files Browse the repository at this point in the history
  • Loading branch information
jarifibrahim committed Sep 24, 2018
1 parent da8831c commit 92170e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions workitem/enum_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,8 @@ func (t EnumType) ConvertFromModel(value interface{}) (interface{}, error) {
if err != nil {
return nil, fmt.Errorf("error converting enum value: %s", err.Error())
}
if !contains(t.Values, converted) {
return nil, fmt.Errorf("value: %+v (%[1]T) is not part of allowed enum values: %+v", value, t.Values)
}
return converted, nil
}

0 comments on commit 92170e5

Please sign in to comment.