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
1 change: 0 additions & 1 deletion app/services/doc_auth/lexis_nexis/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def handle_invalid_response(http_response)
end

def handle_connection_error(exception:, status_code: nil, status_message: nil)
NewRelic::Agent.notice_error(exception)
DocAuth::Response.new(
success: false,
errors: { network: true },
Expand Down
11 changes: 1 addition & 10 deletions app/services/proofing/aamva/proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,13 @@ def proof(applicant)

build_result_from_response(response, applicant[:state_id_jurisdiction])
rescue => exception
failed_result = Proofing::StateIdResult.new(
Proofing::StateIdResult.new(
success: false, errors: {}, exception: exception, vendor_name: 'aamva:state_id',
transaction_id: nil, verified_attributes: [],
jurisdiction_in_maintenance_window: jurisdiction_in_maintenance_window?(
applicant[:state_id_jurisdiction],
)
)
send_to_new_relic(failed_result)
failed_result
end

private
Expand Down Expand Up @@ -126,13 +124,6 @@ def normalize_address_attributes(attribute_set)
end
end

def send_to_new_relic(result)
if result.mva_timeout?
return # noop
end
NewRelic::Agent.notice_error(result.exception)
end

def successful?(verification_response)
REQUIRED_VERIFICATION_ATTRIBUTES.each do |verification_attribute|
return false unless verification_response.verification_results[verification_attribute]
Expand Down
7 changes: 1 addition & 6 deletions spec/services/doc_auth/lexis_nexis/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,12 @@
expect(response.class).to eq(DocAuth::Response)
end

it 'includes information on the error and notifies NewRelic' do
it 'includes information on the error' do
expected_message = [
subject.class.name,
'Unexpected HTTP response',
status,
].join(' ')
expect(NewRelic::Agent).to receive(:notice_error) do |arg|
expect(arg).to be_an_instance_of(DocAuth::RequestError)
expect(arg.message).to eq(expected_message)
expect(arg.error_code).to eq(status)
end
response = subject.fetch

expect(response.exception.message).to eq(expected_message)
Expand Down
20 changes: 5 additions & 15 deletions spec/services/proofing/aamva/proofer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,7 @@ def self.test_not_successful
.to receive(:send).and_raise(exception)
end

it 'logs to NewRelic' do
expect(NewRelic::Agent).to receive(:notice_error)

it 'includes exception in result' do
result = subject.proof(state_id_data)

expect(result.success?).to eq(false)
Expand All @@ -662,9 +660,7 @@ def self.test_not_successful
context 'the exception is a timeout error' do
let(:exception) { Proofing::TimeoutError.new }

it 'logs to NewRelic' do
expect(NewRelic::Agent).to receive(:notice_error)

it 'returns false for mva exception attributes in result' do
result = subject.proof(state_id_data)

expect(result.success?).to eq(false)
Expand All @@ -683,9 +679,7 @@ def self.test_not_successful
)
end

it 'logs to NewRelic' do
expect(NewRelic::Agent).to receive(:notice_error)

it 'returns true for mva_unavailable?' do
result = subject.proof(state_id_data)

expect(result.success?).to eq(false)
Expand All @@ -704,9 +698,7 @@ def self.test_not_successful
)
end

it 'logs to NewRelic' do
expect(NewRelic::Agent).to receive(:notice_error)

it 'returns true for mva_system_error?' do
result = subject.proof(state_id_data)

expect(result.success?).to eq(false)
Expand All @@ -725,9 +717,7 @@ def self.test_not_successful
)
end

it 'does not log to NewRelic' do
expect(NewRelic::Agent).not_to receive(:notice_error)

it 'returns true for mva_timeout?' do
result = subject.proof(state_id_data)

expect(result.success?).to eq(false)
Expand Down