Allow error message to be a function
Update readme with function as error message example