diff --git a/pagure/hooks/mail.py b/pagure/hooks/mail.py index 6241b9a..c4457e3 100644 --- a/pagure/hooks/mail.py +++ b/pagure/hooks/mail.py @@ -110,7 +110,7 @@ class MailRunner(BaseRunner): ecode = proc.wait() if ecode != 0: print("git_multimail failed") - raise SystemExit(1) + raise Exception("git_multimail failed") class Mail(BaseHook): diff --git a/pagure/hooks/pagure_force_commit.py b/pagure/hooks/pagure_force_commit.py index 3dc048e..7f18ccc 100644 --- a/pagure/hooks/pagure_force_commit.py +++ b/pagure/hooks/pagure_force_commit.py @@ -89,13 +89,11 @@ class PagureForceCommitRunner(BaseRunner): if refname in branches or branches == ["*"]: if set(newrev) == set(["0"]): - print("Deletion is forbidden") session.close() - sys.exit(1) + raise Exception("Deletion is forbidden") elif pagure.lib.git.is_forced_push(oldrev, newrev, repodir): - print("Non fast-forward push are forbidden") session.close() - sys.exit(1) + raise Exception("Non fast-forward push is forbidden") class PagureForceCommitForm(FlaskForm): diff --git a/pagure/hooks/pagure_no_new_branches.py b/pagure/hooks/pagure_no_new_branches.py index addcb63..fe924a0 100644 --- a/pagure/hooks/pagure_no_new_branches.py +++ b/pagure/hooks/pagure_no_new_branches.py @@ -70,11 +70,10 @@ class PagureNoNewBranchRunner(BaseRunner): (oldrev, newrev) = changes[refname] if set(oldrev) == set(["0"]): - print( - "Creating a new reference/branch is not allowed in this" - " project." + raise Exception( + "Creating a new reference/branch is not " + "allowed in this project." ) - sys.exit(1) class PagureNoNewBranchesForm(FlaskForm): diff --git a/pagure/hooks/pagure_unsigned_commits.py b/pagure/hooks/pagure_unsigned_commits.py index 809a6d2..00afeee 100644 --- a/pagure/hooks/pagure_unsigned_commits.py +++ b/pagure/hooks/pagure_unsigned_commits.py @@ -103,7 +103,7 @@ class PagureUnsignerRunner(BaseRunner): print(" - Commit: %s is signed: %s" % (commit, signed)) if not signed: print("Commit %s is not signed" % commit) - sys.exit(1) + raise Exception("Commit %s is not signed" % commit) class PagureUnsignedCommitForm(FlaskForm):