From a2da070ca432e9347ca74280be61877ddaa9e14c Mon Sep 17 00:00:00 2001 From: Jamie Gaskins Date: Wed, 5 May 2021 12:48:46 -0400 Subject: [PATCH] Handle GitHub "Repository access blocked" error (#13648) * Handle GitHub "Repository access blocked" error We've been seeing a lot of these errors on DEV, and it's a pretty reasonable expectation that if we're being blocked from seeing them using the user's OAuth access token that this isn't temporary. * Re-raise so we don't swallow this error * Constant name != company name???!?!?! --- app/workers/github_repos/repo_sync_worker.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/workers/github_repos/repo_sync_worker.rb b/app/workers/github_repos/repo_sync_worker.rb index 1eef2b6a9..8ff87b789 100644 --- a/app/workers/github_repos/repo_sync_worker.rb +++ b/app/workers/github_repos/repo_sync_worker.rb @@ -37,6 +37,12 @@ module GithubRepos Github::Errors::AccountSuspended, Github::Errors::RepositoryUnavailable repo.destroy + rescue Github::Errors::ClientError => e + if e.message.include? "Repository access blocked" + repo.destroy + else + raise e + end end end end