handle exceptions when trying to log in