fix: Exception tracking for dialogflow bot service (#6593)

This commit is contained in:
Tejaswini Chile
2023-03-02 21:33:07 +05:30
committed by GitHub
parent a6405ea339
commit a4fc0eef4b
2 changed files with 10 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ class Integrations::BotProcessorService
process_content(message)
rescue StandardError => e
ChatwootExceptionTracker.new(e, account: agent_bot).capture_exception
ChatwootExceptionTracker.new(e, account: hook).capture_exception
end
private

View File

@@ -35,6 +35,15 @@ describe Integrations::Dialogflow::ProcessorService do
end
end
context 'when dilogflow raises exception' do
it 'tracks hook into exception tracked' do
last_message = conversation.reload.messages.last.content
allow(dialogflow_service).to receive(:query_result).and_raise(StandardError)
processor.perform
expect(conversation.reload.messages.last.content).to eql(last_message)
end
end
context 'when dialogflow returns fullfillment text to be empty' do
let(:dialogflow_response) do
ActiveSupport::HashWithIndifferentAccess.new(