Modify method to be able to display custom error messages.