From e1bd750fc7d6bc7d43e2da872732ddd2cbb01f91 Mon Sep 17 00:00:00 2001 From: Christine Wang Date: Wed, 29 Jan 2025 10:18:05 -0800 Subject: [PATCH] fix: handle 404 github exception get contents --- src/codegen/git/clients/git_repo_client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/codegen/git/clients/git_repo_client.py b/src/codegen/git/clients/git_repo_client.py index aab02affe..3d2321a07 100644 --- a/src/codegen/git/clients/git_repo_client.py +++ b/src/codegen/git/clients/git_repo_client.py @@ -82,6 +82,11 @@ def get_contents(self, file_path: str, ref: str | None = None) -> str | None: except UnknownObjectException: logger.info(f"File: {file_path} not found in ref: {ref}") return None + except GithubException as e: + if e.status == 404: + logger.info(f"File: {file_path} not found in ref: {ref}") + return None + raise def get_last_modified_date_of_path(self, path: str) -> datetime: """Uses the GitHub API to return the last modified date of a given directory or file.