Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception running "legendary list" with wi-fi down #447

Closed
RocketHog55 opened this issue Jul 2, 2022 · 0 comments
Closed

Unhandled exception running "legendary list" with wi-fi down #447

RocketHog55 opened this issue Jul 2, 2022 · 0 comments

Comments

@RocketHog55
Copy link

RocketHog55 commented Jul 2, 2022

Platform

Operating system and version: Windows 10
Legendary version (legendary -V): 0.20.27

Expected Behavior

ConnectionError Exception should be handled similar to HTTPError, with the "HTTP request for login failed" log message.

Current Behavior

With the wifi off, legendary auth fails with an unhandled ConnectionError exception.
output:
`[cli] INFO: Logging in...
[Core] INFO: Trying to re-use existing login session...
[Core] WARNING: Resuming failed for unknown reason: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='account-public-service-prod03.ol.epicgames.com', port=443): Max retries exceeded with url: /account/api/oauth/verify (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002324C2A4F10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))"))
[Core] INFO: Falling back to using refresh token...
[Core] INFO: Logging in...
Traceback (most recent call last):
File "urllib3\connection.py", line 174, in _new_conn
File "urllib3\util\connection.py", line 72, in create_connection
File "socket.py", line 954, in getaddrinfo
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "urllib3\connectionpool.py", line 703, in urlopen
File "urllib3\connectionpool.py", line 386, in _make_request
File "urllib3\connectionpool.py", line 1040, in _validate_conn
File "urllib3\connection.py", line 358, in connect
File "urllib3\connection.py", line 186, in _new_conn
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000002324C2A4850>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "requests\adapters.py", line 440, in send
File "urllib3\connectionpool.py", line 785, in urlopen
File "urllib3\util\retry.py", line 592, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='account-public-service-prod03.ol.epicgames.com', port=443): Max retries exceeded with url: /account/api/oauth/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002324C2A4850>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "legendary\cli.py", line 3053, in
File "legendary\cli.py", line 2964, in main
File "legendary\cli.py", line 190, in list_games
File "legendary\core.py", line 227, in login
File "legendary\api\egs.py", line 105, in start_session
File "requests\sessions.py", line 577, in post
File "requests\sessions.py", line 529, in request
File "requests\sessions.py", line 645, in send
File "requests\adapters.py", line 519, in send
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='account-public-service-prod03.ol.epicgames.com', port=443): Max retries exceeded with url: /account/api/oauth/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002324C2A4850>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
[11008] Failed to execute script 'cli' due to unhandled exception!`

Steps to Reproduce

  1. Turn off wifi
  2. run legendary list

Additional information

Fix is simple, in core, import ConnectionError along with HTTPError from requests.exceptions, and in login(), handle ConnectionError the same as HTTPError:

        except (HTTPError, ConnectionError) as e:
            self.log.error(f'HTTP request for login failed: {e!r}, please try again later.')
            return False
@derrod derrod closed this as completed in a73d069 Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant