chore: Upgrade Exception tracking (#4638)

- Upgrade Sentry Libraries
- Enable provision for account and user info in error tracking
- Add ChatwootExceptionTracker

fixes: #4375
This commit is contained in:
Sojan Jose
2022-05-09 14:23:19 +05:30
committed by GitHub
parent 360b438a55
commit 04dfb034cc
25 changed files with 173 additions and 108 deletions

View File

@@ -12,7 +12,7 @@ class AutomationRules::ActionService
begin
send(action[:action_name], action[:action_params])
rescue StandardError => e
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, account: @account).capture_exception
end
end
ensure

View File

@@ -9,7 +9,7 @@ class Facebook::SendOnFacebookService < Base::SendOnChannelService
send_message_to_facebook fb_text_message_params if message.content.present?
send_message_to_facebook fb_attachment_message_params if message.attachments.present?
rescue Facebook::Messenger::FacebookError => e
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, account: message.account, user: message.sender).capture_exception
# TODO : handle specific errors or else page will get disconnected
# channel.authorization_error!
end

View File

@@ -38,7 +38,7 @@ class Instagram::MessageText < Instagram::WebhooksBaseService
raise
rescue StandardError => e
result = {}
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, account: @inbox.account).capture_exception
end
find_or_create_contact(result)

View File

@@ -17,7 +17,7 @@ class Instagram::SendOnInstagramService < Base::SendOnChannelService
send_to_facebook_page attachament_message_params if message.attachments.present?
send_to_facebook_page message_params
rescue StandardError => e
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, account: message.account, user: message.sender).capture_exception
# TODO : handle specific errors or else page will get disconnected
# channel.authorization_error!
end

View File

@@ -7,7 +7,7 @@ class MessageTemplates::Template::EmailCollect
conversation.messages.create!(email_input_box_template_message_params)
end
rescue StandardError => e
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, account: conversation.account).capture_exception
true
end

View File

@@ -6,7 +6,7 @@ class MessageTemplates::Template::Greeting
conversation.messages.create!(greeting_message_params)
end
rescue StandardError => e
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, account: conversation.account).capture_exception
true
end

View File

@@ -6,7 +6,7 @@ class MessageTemplates::Template::OutOfOffice
conversation.messages.create!(out_of_office_message_params)
end
rescue StandardError => e
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, account: conversation.account).capture_exception
true
end

View File

@@ -9,7 +9,7 @@ class Twilio::SendOnTwilioService < Base::SendOnChannelService
begin
twilio_message = client.messages.create(**message_params)
rescue Twilio::REST::TwilioError => e
Sentry.capture_exception(e)
ChatwootExceptionTracker.new(e, user: message.sender, account: message.account).capture_exception
end
message.update!(source_id: twilio_message.sid) if twilio_message
end