chore: use specific exceptions instead of generic
Signed-off-by: Zack Koppert <zkoppert@github.com>
This commit is contained in:
Родитель
255dfef621
Коммит
b31d2f0dcd
|
@ -154,7 +154,7 @@ def clone_repository(gh_actor, token, endpoint, repo):
|
|||
repo_name = repo["name"]
|
||||
try:
|
||||
os.system(f"git clone https://{gh_actor}:{token}@{endpoint}/{repo_full_name}")
|
||||
except Exception as e: # pylint: disable=broad-exception-caught
|
||||
except OSError as e:
|
||||
print(f"Failed to clone repository: {e}")
|
||||
return None
|
||||
return repo_name
|
||||
|
|
|
@ -65,7 +65,7 @@ class TestCloneRepository(unittest.TestCase):
|
|||
"""
|
||||
Test the clone_repository function when the clone fails.
|
||||
"""
|
||||
mock_system.side_effect = Exception("Clone failed") # Simulate clone failure
|
||||
mock_system.side_effect = OSError("Clone failed") # Simulate clone failure
|
||||
|
||||
result = clone_repository(
|
||||
gh_actor="test_actor",
|
||||
|
|
Загрузка…
Ссылка в новой задаче