Commit db417054 authored by syasonik's avatar syasonik

Handle errors with repos api

parent 13851f12
......@@ -63,6 +63,10 @@ class ErrorTrackingIssueLinkWorker # rubocop:disable Scalability/IdempotentWorke
sentry_client
.repos(organization_slug)
.find { |repo| repo.project_id == issue.project_id && repo.status == 'active' }
rescue Sentry::Client::Error => e
logger.info("Unable to retrieve Sentry repo for organization #{organization_slug}, id #{sentry_issue_id}, with error: #{e.message}")
nil
end
def organization_slug
......
......@@ -95,5 +95,19 @@ describe ErrorTrackingIssueLinkWorker do
it_behaves_like 'attempts to create a link via plugin'
end
context 'when Sentry repos request errors' do
it 'falls back to creating a link via plugin' do
expect_next_instance_of(Sentry::Client) do |client|
expect(client).to receive(:repos).with('sentry-org').and_raise(Sentry::Client::Error)
expect(client)
.to receive(:create_issue_link)
.with(nil, sentry_issue.sentry_issue_identifier, issue)
.and_return(true)
end
expect(subject).to be true
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment