Added error message function to functions, exercise 3.5.1. part 4