added error handling that redirects users to a new page and shows them the error