fix: Handle Twilio::REST::RestError (#8257)

This commit is contained in:
Muhsin Keloth
2023-10-31 16:23:34 +05:30
committed by GitHub
parent 11b27f9805
commit 29f18c7f18
2 changed files with 12 additions and 1 deletions

View File

@@ -8,8 +8,9 @@ class Twilio::SendOnTwilioService < Base::SendOnChannelService
def perform_reply
begin
twilio_message = channel.send_message(**message_params)
rescue Twilio::REST::TwilioError => e
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
end