Allow a function to be passed to errorMessage