Added the possibility to pass functions as error message overrides