Validates that a value is a non-negative integer, or undefined. Throws if not.
Value to validate
Name of the field for error messages
Validates that a value is a non-negative integer, or undefined. Throws if not.