Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRefactor: improve error handling in GithubRepos::RepoSyncWorker #10106
Comments
|
Thanks for the issue! We'll take your request into consideration and follow up if we decide to tackle this issue. To our amazing contributors: issues labeled To claim an issue to work on, please leave a comment. If you've claimed the issue and need help, please ping @forem/oss and we will follow up within 3 business days. For full info on how to contribute, please check out our contributors guide. |
|
FYI I'll give this one a crack. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Currently we're inspecting the error message to determine if a user's account was suspended or if the repository has become unavailable so that we can destroy it
forem/app/workers/github_repos/repo_sync_worker.rb
Lines 32 to 37 in 25e20bd
Ockokit(the GitHub library we use) has two specific errors for those two cases:Octokit::RepositoryUnavailableandOctokit::AccountSuspended.It'd be nice to replace those messages inspection with the correct error classes.
See https://github.com/octokit/octokit.rb/blob/a69f5eab0a2fb2763fcda9fadcb0c961df96a373/lib/octokit/error.rb#L265 and https://github.com/octokit/octokit.rb/blob/a69f5eab0a2fb2763fcda9fadcb0c961df96a373/lib/octokit/error.rb#L257
By adding two exceptions similarly named,
RepositoryUnavailableandAccountSuspended, to https://github.com/forem/forem/blob/master/app/services/github/errors.rb one should be able to handle them correctly in the worker, without inspecting the message and thus keeping the same behaviourOriginally posted by @rhymes in #10103 (comment)