From 4096e0ad5c7a82a2d9cf4ab779ccf7461d2ca9c2 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Mon, 30 Jan 2017 16:05:41 +1100 Subject: [PATCH] small fix for server details being missing, stop crash and just try connection dont return None for server details being missing, throw as we need to get to the botton of this --- addon.xml | 2 +- resources/lib/connect/connectionmanager.py | 6 +++--- resources/lib/downloadutils.py | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/addon.xml b/addon.xml index af4d8732..059daa9b 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/connect/connectionmanager.py b/resources/lib/connect/connectionmanager.py index 968c146d..b762a571 100644 --- a/resources/lib/connect/connectionmanager.py +++ b/resources/lib/connect/connectionmanager.py @@ -539,12 +539,12 @@ class ConnectionManager(object): log.info("skipping test at index: %s" % index) return self._testNextConnectionMode(tests, index+1, server, options) - log.info("testing connection mode %s with server %s" % (mode, server['Name'])) + log.info("testing connection mode %s with server %s" % (mode, server.get('Name'))) try: result = self._tryConnect(address, timeout, options) except Exception: - log.error("test failed for connection mode %s with server %s" % (mode, server['Name'])) + log.error("test failed for connection mode %s with server %s" % (mode, server.get('Name'))) if enableRetry: # TODO: wake on lan and retry @@ -561,7 +561,7 @@ class ConnectionManager(object): } else: log.info("calling onSuccessfulConnection with connection mode %s with server %s" - % (mode, server['Name'])) + % (mode, server.get('Name'))) return self._onSuccessfulConnection(server, result, mode, options) def _onSuccessfulConnection(self, server, systemInfo, connectionMode, options): diff --git a/resources/lib/downloadutils.py b/resources/lib/downloadutils.py index bf6c9a72..96ec40c7 100644 --- a/resources/lib/downloadutils.py +++ b/resources/lib/downloadutils.py @@ -217,8 +217,10 @@ class DownloadUtils(object): server = self.session if server_id is None else self.servers[server_id] if server is None or server.get("Server", None) is None or server.get("UserId", None) is None: - log.info("Aborting download, Server Details Error: %s", server) - return None + log.info("Aborting download, Server Details Error: %s url=%s" % (server, url)) + exc = Exception("Aborting download, Server Details Error: %s url=%s" % (server, url)) + #exc.quiet = True + raise exc if server_id is None and self.session_requests is not None: # Main server session = self.session_requests @@ -346,9 +348,6 @@ class DownloadUtils(object): log.error("unknown error connecting to: %s", url) raise - # something went wrong so return a None as we have no valid data - return None - def _ensure_server(self, server_id=None): if server_id is None and self.session_requests is None: