From 76bcea909c8a45646123385d82793e8d00ba87b7 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Sat, 17 Nov 2012 14:25:25 +0100 Subject: [PATCH] daklib/archive.py: give a nicer error message for already known .changes Bug-Debian: http://bugs.debian.org/693163 --- daklib/archive.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/daklib/archive.py b/daklib/archive.py index 26acaf60..6a424cdf 100644 --- a/daklib/archive.py +++ b/daklib/archive.py @@ -33,6 +33,7 @@ import os import shutil import subprocess from sqlalchemy.orm.exc import NoResultFound +import sqlalchemy.exc import tempfile import traceback @@ -1004,8 +1005,11 @@ class ArchiveUpload(object): db_changes.changelog_id = changelog_id db_changes.closes = self.changes.closed_bugs - self.transaction.session.add(db_changes) - self.transaction.session.flush() + try: + self.transaction.session.add(db_changes) + self.transaction.session.flush() + except sqlalchemy.exc.IntegrityError: + raise ArchiveException('{0} is already known.'.format(self.changes.filename)) return db_changes -- 2.39.5