error handling in the form of alert boxes for activity 2