From b80237c96ccf449884cbda4dc22b57804c106965 Mon Sep 17 00:00:00 2001 From: Jonathan Nevelson Date: Wed, 29 Jul 2020 21:32:41 +0000 Subject: [PATCH] Fix error handling logic (#30) The error needs to be re-raised when it's a 404 so it gets retried, not the other way around. --- CHANGELOG.md | 4 ++++ gordian/repo.py | 4 +--- setup.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ac24dc..a968483 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [3.0.1] - 2020-07-29 +### Fixed +- Fixed error handling logic when forking to retry when Github returns 404 (because that implies the repo hasn't yet finished forking) + ## [3.0.0] - 2020-07-17 ### Changed - Made forking optional via `--fork` argument, which is mutually exclusive with `--branch` diff --git a/gordian/repo.py b/gordian/repo.py index 5032959..2029727 100644 --- a/gordian/repo.py +++ b/gordian/repo.py @@ -125,10 +125,8 @@ def _get_repo_contents(self, path): return self._source_repo.get_contents(path, self.source_branch) except GithubException as e: if e.status == 404: - logger.info(f'Repo does not contain {self.source_branch} branch. Exiting...') - sys.exit(1) - else: raise e + logger.info(f'Error fetching repo contents: {e}') @retry(GithubException, tries=3, delay=1, backoff=2) def _make_branch(self): diff --git a/setup.py b/setup.py index 9456b49..4d01ce8 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup_reqs = ['pytest', 'pytest-cov', 'pytest-runner', 'flake8'] setuptools.setup( name="gordian", - version="3.0.0", + version="3.0.1", author="Intuit", author_email="cg-sre@intuit.com", description="A tool to search and replace files in a Git repo",