mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-21 11:27:38 +03:00
Don't spam a stacktrace on requests.ConnectionError
ConnectionErrors are expected and not something we can fix. The exception handler that was catching these previously is a catchall intended to stop EDMC as a whole from crashing from something unexpected. Closes #1082
This commit is contained in:
parent
13ba5fede9
commit
c4e9767974
@ -979,6 +979,11 @@ class AppWindow(object):
|
||||
companion.session.invalidate()
|
||||
self.login()
|
||||
|
||||
except companion.ServerConnectionError as e:
|
||||
logger.debug(f'Exception while contacting server: {e}')
|
||||
err = self.status['text'] = str(e)
|
||||
play_bad = True
|
||||
|
||||
except Exception as e: # Including CredentialsError, ServerError
|
||||
logger.debug('"other" exception', exc_info=e)
|
||||
err = self.status['text'] = str(e)
|
||||
|
@ -17,6 +17,7 @@ import random
|
||||
import time
|
||||
import urllib.parse
|
||||
import webbrowser
|
||||
import socket
|
||||
from builtins import object, range, str
|
||||
from email.utils import parsedate
|
||||
from os.path import join
|
||||
@ -170,6 +171,10 @@ class ServerError(Exception):
|
||||
self.args = (_("Error: Frontier CAPI didn't respond"),)
|
||||
|
||||
|
||||
class ServerConnectionError(ServerError):
|
||||
"""Exception class for CAPI connection errors."""
|
||||
|
||||
|
||||
class ServerLagging(Exception):
|
||||
"""Exception Class for CAPI Server lagging.
|
||||
|
||||
@ -537,6 +542,10 @@ class Session(object):
|
||||
logger.trace('Trying...')
|
||||
r = self.session.get(self.server + endpoint, timeout=timeout) # type: ignore
|
||||
|
||||
except requests.ConnectionError as e:
|
||||
logger.debug(f'Unable to resolve name for CAPI: {e} (for request: {endpoint})')
|
||||
raise ServerConnectionError(f'Unable to connect to endpoint {endpoint}') from e
|
||||
|
||||
except Exception as e:
|
||||
logger.debug('Attempting GET', exc_info=e)
|
||||
raise ServerError(f'{_("Frontier CAPI query failure")}: {endpoint}') from e
|
||||
|
Loading…
x
Reference in New Issue
Block a user