An error message means that the user is doing something you haven't thought about. Focus your energy on what the user was trying to do and solve it. That way you will avoid the error message at all.
Simple example: one of the most common error messages are misspelled mail/password in order to authenticate. Have you thought on other ways of authentication that might be more straight forward? that can eliminate the error messages altogether.