Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/services/proofing/lexis_nexis/ddp/proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def send_verification_request(applicant)
def proof(applicant)
response = send_verification_request(applicant)
process_response(response)
rescue => exception
NewRelic::Agent.notice_error(exception)
Proofing::Result.new(exception: exception)
end

private
Expand Down
16 changes: 16 additions & 0 deletions spec/services/proofing/lexis_nexis/ddp/proofing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,21 @@
expect(result.errors).to be_empty
end
end

context 'when the response raises an exception' do
let(:response_body) { '' }

it 'returns an exception result' do
error = RuntimeError.new('hi')

expect(NewRelic::Agent).to receive(:notice_error).with(error)

stub_request(:post, verification_request.url).to_raise(error)

expect(result.success?).to eq(false)
expect(result.errors).to be_empty
expect(result.exception).to eq(error)
end
end
end
end