From 67fb4461fc8378051bc5091733aa2adf2d6a6739 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 20 2018 09:24:58 +0000 Subject: Catch exceptions thrown by the task and return it to the user Fixes https://pagure.io/fedora-infrastructure/issue/6700 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index c5e05c0..54beaa0 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -1270,7 +1270,10 @@ def new_remote_request_pull(repo, username=None, namespace=None): taskid, form, 'ui_ns.new_remote_request_pull', repo=repo.name, username=username, namespace=namespace) # Make sure to collect any exceptions resulting from the task - result.get(timeout=0) + try: + result.get(timeout=0) + except Exception as err: + flask.abort(500, err) branch_from = form.branch_from.data.strip() branch_to = form.branch_to.data.strip()