Skip to content

Commit

Permalink
chore: Remove sentry exceptions for the message status failed errors (#…
Browse files Browse the repository at this point in the history
…8285)

- Remove sending exceptions to Sentry after capturing the message failed errors.
  • Loading branch information
muhsin-k committed Nov 2, 2023
1 parent 4999f7e commit 16c36a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions app/services/facebook/send_on_facebook_service.rb
Expand Up @@ -76,10 +76,8 @@ def sent_first_outgoing_message_after_24_hours?

def handle_facebook_error(exception)
# Refer: https://github.com/jgorset/facebook-messenger/blob/64fe1f5cef4c1e3fca295b205037f64dfebdbcab/lib/facebook/messenger/error.rb
if exception.to_s.include?('The session has been invalidated') || exception.to_s.include?('Error validating access token')
channel.authorization_error!
else
ChatwootExceptionTracker.new(exception, account: message.account, user: message.sender).capture_exception
end
return unless exception.to_s.include?('The session has been invalidated') || exception.to_s.include?('Error validating access token')

channel.authorization_error!
end
end
1 change: 0 additions & 1 deletion app/services/twilio/send_on_twilio_service.rb
Expand Up @@ -9,7 +9,6 @@ def perform_reply
begin
twilio_message = channel.send_message(**message_params)
rescue Twilio::REST::TwilioError, Twilio::REST::RestError => e
ChatwootExceptionTracker.new(e, user: message.sender, account: message.account).capture_exception
message.update!(status: :failed, external_error: e.message)
end
message.update!(source_id: twilio_message.sid) if twilio_message
Expand Down

0 comments on commit 16c36a7

Please sign in to comment.