1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-16 17:12:21 +03:00

Merge pull request #1090 from A-UNDERSCORE-D/fix/1082-dont-spam-on-error

Don't spam a stacktrace on requests.ConnectionError
This commit is contained in:
Athanasius 2021-06-07 18:09:31 +01:00 committed by GitHub
commit 2d6a78a865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -979,6 +979,11 @@ class AppWindow(object):
companion.session.invalidate()
self.login()
except companion.ServerConnectionError as e:
logger.warning(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)

View File

@ -170,6 +170,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 +541,10 @@ class Session(object):
logger.trace('Trying...')
r = self.session.get(self.server + endpoint, timeout=timeout) # type: ignore
except requests.ConnectionError as e:
logger.warning(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