Return a clear error message when the source repo for a GHES-to-GHEC migration doesn't exist
- Dominant language
- C#
- Stars
- 478
- Forks
- 146
- Avg merge
- 7d 21h
- Merged PRs (30d)
- 2
Description
When the source repo doesn't exist for a GHES-to-GHEC migration, the `migrate-repo` command currently fails with a not very helpful error:
```
System.Net.Http.HttpRequestException: Response status code does not indicate success: 422 (Unprocessable Entity).
```
Under the hood, this happens because we call the "Start an organization migration" REST API, and the GitHub API responds like this:
```
422 Unprocessable Entity
{"message":"Validation Failed","errors":[{"resource":"Migration","field":"repositories","index":0,"code":"invalid_value"},{"resource":"Migration","field":"repositories","code":"missing_field"}],"documentation_url":"https://docs.github.com/enterprise/3.4/rest/reference/migrations#start-an-organization-migration"}
```
We should handle this case better. We could either:
1. Add a check at the start of the migration, like the check we already have to ensure that the target repo doesn't exist, to check that the source repo exists
2. Convert the above error returned by the REST API into a helpful error that tells you what the problem actually is
Contributor guide
Assessment
This issue has not been assessed yet.