Add better error handling for login errors