Moved all error messages to global array

Some of the error messages were in functions, Move them all into the error variable