ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [incubator-ponymail] branch master updated: Don't hide built-in ConnectionError
Date Sat, 26 May 2018 12:32:35 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git


The following commit(s) were added to refs/heads/master by this push:
     new 9a529fe  Don't hide built-in ConnectionError
9a529fe is described below

commit 9a529fe8e12027b134bd89cc6873183639540041
Author: Sebb <sebb@apache.org>
AuthorDate: Sat May 26 13:32:33 2018 +0100

    Don't hide built-in ConnectionError
---
 tools/elastic.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/elastic.py b/tools/elastic.py
index a3a9c98..f0c35ca 100755
--- a/tools/elastic.py
+++ b/tools/elastic.py
@@ -26,8 +26,9 @@ import logging
 import certifi
 
 try:
-    from elasticsearch import Elasticsearch, helpers, ConnectionError
+    from elasticsearch import Elasticsearch, helpers
     from elasticsearch import VERSION as ES_VERSION
+    from elasticsearch import ConnectionError as ES_ConnectionError
 except ImportError as e:
     sys.exit("Sorry, you need to install the elasticsearch module from pip first. (%s)" %
str(e))
 
@@ -78,7 +79,7 @@ class Elastic:
         if not self.dbVersion:
             try:
                 self.dbVersion = self.info()['version']['number']
-            except ConnectionError:
+            except ES_ConnectionError:
                 # default if cannot connect; allows retry
                 return '0.0.0'
         return self.dbVersion
@@ -155,5 +156,5 @@ if __name__ == '__main__':
     try:
         print(es.indices.exists(index='ponymail'))
         print(es.indices.exists('test'))
-    except Exception as e:
+    except ES_ConnectionError as e:
         print(type(e))

-- 
To stop receiving notification emails like this one, please contact
sebb@apache.org.

Mime
View raw message