From 42b836f623799fa8b1725d9b41b4d32a2301685d Mon Sep 17 00:00:00 2001 From: Moritz Federspiel Date: Tue, 16 Jan 2024 15:13:26 +0100 Subject: [PATCH] fix: Catch 404s for non-existing hooks. Fixes #176 Explanation: Repositories where no webhooks are defined return 404 errors. This breaks further script execution. --- github_backup/github_backup.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/github_backup/github_backup.py b/github_backup/github_backup.py index 860b73a..d429acb 100644 --- a/github_backup/github_backup.py +++ b/github_backup/github_backup.py @@ -1189,8 +1189,11 @@ def backup_hooks(args, repo_cwd, repository, repos_template): template = "{0}/{1}/hooks".format(repos_template, repository["full_name"]) try: _backup_data(args, "hooks", template, output_file, hook_cwd) - except SystemExit: - logger.info("Unable to read hooks, skipping") + except Exception as e: + if "404" in str(e): + logger.info("Unable to read hooks, skipping") + else: + raise e def backup_releases(args, repo_cwd, repository, repos_template, include_assets=False):