Add friendlier error handling for git repository cloning errors #2

Open
opened 2026-03-28 22:38:30 -04:00 by danielfdickinson · 0 comments

Description: Add explicit error handling around git.Repo.clone_from() to provide better visibility into cloning failures while maintaining fatal error behavior.

Current behavior: The git.Repo.clone_from() call in src/repotool/repos.py can fail and raise exceptions without specific logging.

Proposed enhancement:

From GitLabDuo - review and adjust as appropriate.

try:
  new_repo = git.Repo.clone_from(repo_url, repo_path)
except Exception as e:
  logger.error("Failed to clone repository from %s: %s", repo_url, str(e))
  raise

This will:

  • Log specific error details for debugging
  • Re-raise exceptions to maintain fatal behavior
  • Prevent RepoUpdater creation when cloning fails
  • Provide better visibility into failures
**Description:** Add explicit error handling around `git.Repo.clone_from()` to provide better visibility into cloning failures while maintaining fatal error behavior. **Current behavior:** The `git.Repo.clone_from()` call in `src/repotool/repos.py` can fail and raise exceptions without specific logging. **Proposed enhancement:** From GitLabDuo - review and adjust as appropriate. ```python try: new_repo = git.Repo.clone_from(repo_url, repo_path) except Exception as e: logger.error("Failed to clone repository from %s: %s", repo_url, str(e)) raise ``` This will: * Log specific error details for debugging * Re-raise exceptions to maintain fatal behavior * Prevent RepoUpdater creation when cloning fails * Provide better visibility into failures
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
orepotool/openwrt-repotool#2
No description provided.