microsoft / DevHomeAzureExtension

Dev Home Azure Extension
MIT License
68 stars 15 forks source link

Fix crash when cloning a repo that does not have project in the URL. #33

Closed dkbennett closed 7 months ago

dkbennett commented 7 months ago

Summary of the pull request

An uncaught exception can occur in the RepositoryProvider when given a valid Repository URI that does not have a project segment.

References and relevant issues

This fixes the crash part of #31. It does not fix the scenario working, just stops the crash.

Detailed description of the pull request / Additional comments

This is a case where the project and the repository have the same name and Azure makes a shorter URL by removing the project name. This led to an invalid request to GetRepositoryAsync(), which threw an exception that was uncaught.

The fix moves up a try-catch block to be larger than it was and include Azure GetRepository calls and DeveloperId calls which could throw and, if uncaught, crash the extension and DevHome.

Validation steps performed

Followed instructions for scenario testing described here: https://github.com/microsoft/devhome/pull/1849

PR checklist