[Qa-jenkins-scm] [jenkins.debian.net] 04/06: reproducible: common.py: nest try/except clauses to really catch every possible sql error
Holger Levsen
holger at moszumanska.debian.org
Tue Aug 18 11:36:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit 15efd34ed215bbb6cdaafa77fbc5e9922b79fc3e
Author: Mattia Rizzolo <mattia at mapreri.org>
Date: Mon Aug 17 10:26:32 2015 +0000
reproducible: common.py: nest try/except clauses to really catch every possible sql error
---
bin/reproducible_common.py | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 6ddcf39..653bff1 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -320,23 +320,24 @@ def start_udd_connection():
port = 5432
db = "udd"
try:
- log.debug("Starting connection to the UDD database")
- conn = psycopg2.connect(
- database=db,
- user=username,
- host=host,
- 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
+ try:
+ log.debug("Starting connection to the UDD database")
+ conn = psycopg2.connect(
+ database=db,
+ user=username,
+ host=host,
+ 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. '
+ 'Maybe 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:')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list