Open sylvain-combe-sonarsource opened 1 week ago
Can you try with the version on this branch? I have added an error log to get more insights.
branches, err := gitClient.GetBranches(ctx, git.GetBranchesArgs{
RepositoryId: &repoID,
Project: &projectID,
})
if err != nil {
loggers.Errorf("Error get GetBranches for repository and branch %s - %s: %v", repoID, defaultBranch, err)
return "", 0, 0, err
}
Once we understand the problem and where to gracefully handle it, we will still need a fix.
We could also add a trace log before each function is called, to have the full path followed by the code. This would take more time but can be done if needed, from there, it should be easy to handle the error
I believe there is no point logging the dafultBranch parameter in the handleNonDefaultBranch method.
Your comment's code (I don't see your commit) does not handle errors more gracefully than the existing code.
For some projects the handleNonDefaultBranch method of the getazure package will fail. This part of the code is responsible:
An error there breaks the entire script, it should be handled gracefully.