diff --git a/app/canary/dao.rb b/app/canary/dao.rb index 07b9087..ebf86b1 100644 --- a/app/canary/dao.rb +++ b/app/canary/dao.rb @@ -1,6 +1,7 @@ require 'concurrent/hash' require 'mini_cache' require 'net/http' +require 'openssl' module CodeValet module Canary @@ -15,6 +16,7 @@ module CodeValet Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, + OpenSSL::SSL::SSLError, ].freeze # Access the caching object diff --git a/spec/dao/sentry_spec.rb b/spec/dao/sentry_spec.rb index 038367b..aa3ab2e 100644 --- a/spec/dao/sentry_spec.rb +++ b/spec/dao/sentry_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' require 'json' +require 'openssl' require 'canary/dao/sentry' @@ -45,6 +46,15 @@ describe CodeValet::Canary::DAO::Sentry do expect(subject.projects).to eql(projects) end end + + # https://github.com/codevalet/canary/issues/2 + it 'should gracefully handle OpenSSL errors' do + expect(SentryApi).to receive(:projects).and_raise(OpenSSL::SSL::SSLError) + expect(Raven).not_to receive(:capture_exception) + + expect(subject.projects).to be_empty + expect(subject).to be_errored + end end it { should respond_to :issues_for }