From 7716e2dc15cf85e3ca457b402839489e272a7960 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 05 2018 15:21:18 +0000 Subject: Only print the traceback on debug or non-pre-receive hooks Fixes https://pagure.io/pagure/issue/3974 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/hooks/__init__.py b/pagure/hooks/__init__.py index ac71ff6..67212ae 100644 --- a/pagure/hooks/__init__.py +++ b/pagure/hooks/__init__.py @@ -372,8 +372,11 @@ def run_project_hooks( repodir=repodir, changes=changes, ) - except Exception: - traceback.print_exc() + except Exception as e: + if hooktype != "pre-receive" or debug: + traceback.print_exc() + else: + print(str(e)) haderrors = True if project.is_on_repospanner: