From b2ef162763e9f5304d9e824e8211b87a68f461d1 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Mon, 17 Aug 2015 10:06:59 +0000 Subject: reproducible: common.py: catch psycopg2.OperationalError when the connection timeouts in start_udd_connection to output a useful error message --- bin/reproducible_common.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'bin') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index c1475117..6ddcf398 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -328,6 +328,15 @@ def start_udd_connection(): password=password, connect_timeout=5, ) + except psycopg2.OperationalError as err: + if str(err) == 'timeout expired\n': + log.error('Connection to the UDD database replice timed out. ' + 'Probably the machine is offline or just unavailable.') + log.error('Failing nicely anyway, all queries will return an ' + 'empty response.') + return None + else: + raise except: log.error('Erorr connecting to the UDD database replica.' + 'The full error is:') -- cgit v1.2.3-70-g09d2