From 85facfb4c001bbf68ad8da25259abbe57455aa5c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 16 2017 16:16:20 +0000 Subject: Improve the error returned when cloning a remote git repo fails and logging We used to log the errors twice, at as debug and once as exception. @jcline pointed it out in the review, so here it is :) --- diff --git a/pagure/__init__.py b/pagure/__init__.py index 2eb076d..5aa0768 100644 --- a/pagure/__init__.py +++ b/pagure/__init__.py @@ -603,15 +603,17 @@ def get_remote_repo_path(remote_git, branch_from, loop=False): pygit2.clone_repository( remote_git, repopath, checkout_branch=branch_from) except Exception as err: - LOG.debug(err) LOG.exception(err) - flask.abort(500, 'Could not clone the remote git repository') + flask.abort( + 500, + 'The following error was raised when trying to clone the ' + 'remote repo: %s' % str(err) + ) else: repo = pagure.lib.repo.PagureRepo(repopath) try: repo.pull(branch=branch_from, force=True) - except pygit2.GitError as err: # pragma: no-cover - LOG.debug(err) + except pygit2.GitError as err: LOG.exception(err) flask.abort( 500, @@ -619,7 +621,6 @@ def get_remote_repo_path(remote_git, branch_from, loop=False): 'changes from the remote: %s' % str(err) ) except pagure.exceptions.PagureException as err: - LOG.debug(err) LOG.exception(err) flask.abort(500, str(err))