From be12c2d56ef8e975ff4f6d17eb6c9b09bc1e6057 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 20 2015 14:44:18 +0000 Subject: Be careful when editing a tag about database failure --- diff --git a/progit/ui/issues.py b/progit/ui/issues.py index a912e4c..9ab9f77 100644 --- a/progit/ui/issues.py +++ b/progit/ui/issues.py @@ -241,9 +241,14 @@ def edit_tag(repo, tag, username=None): msgs = progit.lib.edit_issue_tags(SESSION, repo, tag, new_tag) - SESSION.commit() - for msg in msgs: - flask.flash(msg) + try: + SESSION.commit() + for msg in msgs: + flask.flash(msg) + except SQLAlchemyError, err: # pragma: no cover + SESSION.rollback() + LOG.error(err) + flask.flash('Could not edit tag: %s' % tag,'error') return flask.redirect(flask.url_for( '.view_settings', repo=repo.name, username=username)