Skip to content

Commit

Permalink
Fix error handling logic (#30)
Browse files Browse the repository at this point in the history
The error needs to be re-raised when it's a 404 so it gets retried, not the other way around.
  • Loading branch information
Jonathan Nevelson authored Jul 29, 2020
1 parent 74321ee commit b80237c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 1 addition & 3 deletions gordian/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
description="A tool to search and replace files in a Git repo",
Expand Down

0 comments on commit b80237c

Please sign in to comment.