github / gh-migration-analyzer

MIT License
64 stars 21 forks source link

Non-Existent Repository or Unauthorized Access Causes Program to Fail #43

Open PStoner3 opened 9 months ago

PStoner3 commented 9 months ago

When analyzing one of my organizations, I ran into a scenario where a repository ID was reported but either didn't exist or I could not access it.

The reported error is

file:///F:/code/nodejs/gh-migration-analyzer/src/api/azureDevOps.js:208
      repo._links.pullRequests.href +
                  ^

TypeError: Cannot read properties of undefined (reading 'pullRequests')
    at getAzureDevOpsRepoPR (file:///F:/code/nodejs/gh-migration-analyzer/src/api/azureDevOps.js:208:19)
    at storeRepositoryPromise (file:///F:/code/nodejs/gh-migration-analyzer/src/api/azureDevOps.js:168:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I am using the latest pull from the master branch.

A simple fix for this would be to add:

if(repo.name === undefined){
      continue;
}

to the top of the do{}while loop in the getAzureDevOpsRepoPR() method.

AryPat commented 8 months ago

Hey @PStoner3! Thanks for reporting an issue! If you would like, you can create a PR to address this.

Otherwise, when I have free time later in the week, I can quickly proceed with your proposed solution.

PStoner3 commented 8 months ago

Sorry for the delay. Yes, I can open a PR. I'll let you know when I do

PStoner3 commented 7 months ago

FYI, PR #46 has been opened and ready for review when you have the time