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:
commit
2d6a78a865
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user