Fetch keys should return KeyNotFound for unknown errors
authorRuben Pollan <meskio@sindominio.net>
Thu, 19 Feb 2015 16:21:56 +0000 (10:21 -0600)
committerRuben Pollan <meskio@sindominio.net>
Thu, 19 Feb 2015 16:40:47 +0000 (10:40 -0600)
changes/bug-4752_error_fetching_keys [new file with mode: 0644]
src/leap/keymanager/__init__.py

diff --git a/changes/bug-4752_error_fetching_keys b/changes/bug-4752_error_fetching_keys
new file mode 100644 (file)
index 0000000..04bf1af
--- /dev/null
@@ -0,0 +1 @@
+- Return always KeyNotFound failure if fetch keys fails on an unknown error
index a1a59f5..3ef6350 100644 (file)
@@ -230,11 +230,11 @@ class KeyManager(object):
             if e.response.status_code == 404:
                 d = defer.fail(KeyNotFound(address))
             else:
-                d = defer.fail(e)
+                d = defer.fail(KeyNotFound(e.message))
             logger.warning("HTTP error retrieving key: %r" % (e,))
             logger.warning("%s" % (res.content,))
         except Exception as e:
-            d = defer.fail(e)
+            d = defer.fail(KeyNotFound(e.message))
             logger.warning("Error retrieving key: %r" % (e,))
         return d