So I've added two ifs, but think that the design of the functions are better.
Looks more promising, but you have a typo in the error message ;-)
retunrning -1",
and maybe you need to document some examples of using policies that don’t bother to check or at least do so quietly (your original idea), just quietly return -1, produce a message and return -1, or message and then throw an exception?
But maybe it’s a TODO ;-)
Paul
---
Paul A. Bristow
Prizet Farmhouse
Kendal, UK LA8 8AB
+44 1539 561830, mobile +44 7714330204