[core] Handle ConnectionError exception on login

Fixes #447
This commit is contained in:
derrod 2022-07-06 16:35:18 +02:00
parent f9a2dae282
commit a73d0694f6

View file

@ -15,7 +15,7 @@ from locale import getdefaultlocale
from multiprocessing import Queue from multiprocessing import Queue
from platform import system from platform import system
from requests import session from requests import session
from requests.exceptions import HTTPError from requests.exceptions import HTTPError, ConnectionError
from sys import platform as sys_platform from sys import platform as sys_platform
from uuid import uuid4 from uuid import uuid4
from urllib.parse import urlencode, parse_qsl from urllib.parse import urlencode, parse_qsl
@ -229,7 +229,7 @@ class LegendaryCore:
self.log.error('Stored credentials are no longer valid! Please login again.') self.log.error('Stored credentials are no longer valid! Please login again.')
self.lgd.invalidate_userdata() self.lgd.invalidate_userdata()
return False return False
except HTTPError as e: except (HTTPError, ConnectionError) as e:
self.log.error(f'HTTP request for login failed: {e!r}, please try again later.') self.log.error(f'HTTP request for login failed: {e!r}, please try again later.')
return False return False