Functions 1 Exercise 4

Refactor the error messages into their own function, have the other
functions use it for error messaging.