fix sentry capture message for webhook
This commit is contained in:
parent
dd3805b7cd
commit
73953a8a57
2 changed files with 5 additions and 2 deletions
|
@ -18,7 +18,7 @@ class WebHookJob < ApplicationJob
|
||||||
if !response.success?
|
if !response.success?
|
||||||
Sentry.set_tags(procedure: procedure_id, dossier: dossier_id)
|
Sentry.set_tags(procedure: procedure_id, dossier: dossier_id)
|
||||||
Sentry.set_extras(web_hook_url: procedure.web_hook_url)
|
Sentry.set_extras(web_hook_url: procedure.web_hook_url)
|
||||||
Sentry.capture_message("Webhook error: #{response.status} // Response: #{response.body}")
|
Sentry.capture_message("Webhook error code: #{response.code} (#{response.return_message}) // Response: #{response.body}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,8 +14,11 @@ describe WebHookJob, type: :job do
|
||||||
|
|
||||||
context 'with error on webhook' do
|
context 'with error on webhook' do
|
||||||
it 'raises' do
|
it 'raises' do
|
||||||
|
allow(Sentry).to receive(:capture_message)
|
||||||
stub_request(:post, web_hook_url).to_return(status: 500, body: "error")
|
stub_request(:post, web_hook_url).to_return(status: 500, body: "error")
|
||||||
expect { job.perform_now }.to raise_error
|
|
||||||
|
job.perform_now
|
||||||
|
expect(Sentry).to have_received(:capture_message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue