You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consistently convert GraphQL errors to OctoshiftCliExceptions with helpful error messages across GithubApi (#868)
In `GithubApi`, we have the helpful `EnsureSuccessGraphQLResponse`
helper which checks the GraphQL response for errors, and if an error is
found, it raises a `OctoshiftCliException`.
Currently, this helper is not used consistently across GraphQL API
calls, which means that we have some cases where the GraphQL API returns
an error and the CLI crashes with an unhelpful
`System.InvalidOperationException: Cannot access child value on
Newtonsoft.Json.Linq.JValue.`.
To find out what actually went wrong, the user has to either:
* (a) use the `--verbose` option or
* (b) manually check the verbose log file
This PR creates a new `PostGraphQLAsync` method on `GitHubClient` which
includes the error handling logic from `EnsureSuccessGraphQLResponse`.
We then use the `PostGraphQLAsync` method instead of `PostAsync` for
GraphQL requests, which means that we get this consistent error handling
for free.
I do not apply this to `ReclaimMannequin` (which has its own error
handling) and `GetMannequins` (which has some complex pagination logic
which I didn't want to mess with right now).
Fixes#867.
<!--
For the checkboxes below you must check each one to indicate that you
either did the relevant task, or considered it and decided there was
nothing that needed doing
-->
- [x] Did you write/update appropriate tests
- [x] Release notes updated (if appropriate)
- [x] Appropriate logging output
- [x] Issue linked
- [ ] Docs updated (or issue created)
- [ ] New package licenses are added to `ThirdPartyNotices.txt` (if
applicable)
<!--
For docs we should review the docs at:
https://docs.github.com/en/early-access/github/migrating-with-github-enterprise-importer
and the README.md in this repo
If a doc update is required based on the changes in this PR, it is
sufficient to create an issue and link to it here. The doc update can be
made later/separately.
The process to update the docs can be found here:
https://github.com/github/docs-early-access#opening-prs
The markdown files are here:
https://github.com/github/docs-early-access/tree/main/content/github/migrating-with-github-enterprise-importer
-->
---------
Co-authored-by: Arin Ghazarian <aringhazarian@github.com>
- Adds retry logic during GHES archive generation in cases of transient failure
2
2
- Added log output linking to migration log URL after migration completes
3
3
- Add support for specifying `--archive-download-host` with `gh bbs2gh migrate-repo` and `gh bbs2gh generate-script`, rather than taking the host from the `--bbs-server-url`
4
+
- Improve handling of GraphQL errors, throwing an exception with the specific error message returned by the API
@@ -697,10 +671,9 @@ public virtual async Task<string> GetUserId(string login)
697
671
};
698
672
699
673
// TODO: Add retry logic here, but need to inspect the actual error message and differentiate between transient failure vs user doesn't exist (only retry on failure)
0 commit comments