Skip to content

Commit

Permalink
Add more context around repo lookup failures (#4002)
Browse files Browse the repository at this point in the history
I've seen a number of errors relating to repo lookups in the logs.
Adding some details to provide more context.
  • Loading branch information
dmjb authored Jul 25, 2024
1 parent 07a22f1 commit fd2c9d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/reconcilers/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (r *Reconciler) handleArtifactsReconcilerEvent(ctx context.Context, evt *me
// first retrieve data for the repository
repository, err := r.store.GetRepositoryByRepoID(ctx, evt.Repository)
if err != nil {
return fmt.Errorf("error retrieving repository: %w", err)
return fmt.Errorf("error retrieving repository %d in project %s: %w", evt.Repository, evt.Project, err)
}

providerID := repository.ProviderID
Expand Down
4 changes: 2 additions & 2 deletions internal/repositories/github/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (r *repositoryService) DeleteByID(ctx context.Context, repositoryID uuid.UU

repo, err := r.GetRepositoryById(ctx, repositoryID, projectID)
if err != nil {
return fmt.Errorf("error retrieving repository: %w", err)
return fmt.Errorf("error retrieving repository %s in project %s: %w", repositoryID, projectID, err)
}

logger.BusinessRecord(ctx).ProviderID = repo.ProviderID
Expand Down Expand Up @@ -286,7 +286,7 @@ func (r *repositoryService) DeleteByName(
},
})
if err != nil {
return fmt.Errorf("error retrieving repository: %w", err)
return fmt.Errorf("error retrieving repository %s/%s in project %s: %w", repoOwner, repoName, projectID, err)
}

logger.BusinessRecord(ctx).Repository = repo.ID
Expand Down

0 comments on commit fd2c9d2

Please sign in to comment.