Allow function as error message provider
Add unit test for unit fields validation