Checking for 404 error code before displaying error message.