Added an exitif to exit if an error message is provided