Validates that a value is a boolean, or undefined. Throws if not.
The value to validate
Name of the field for error messages
Validates that a value is a boolean, or undefined. Throws if not.