Support custom validation and error message.