Extracts an int from dynamic value, validating its type.
int extractIntValue(dynamic value, String errMsg);