Fix: prevent IMAPBadResponse exception from sending the authorization mail (#7154)

This commit is contained in:
Tejaswini Chile
2023-05-22 13:51:56 +05:30
committed by GitHub
parent 0e903d2365
commit 590e4e9c1c
2 changed files with 4 additions and 3 deletions

View File

@@ -7,9 +7,10 @@ class Inboxes::FetchImapEmailsJob < ApplicationJob
return unless should_fetch_email?(channel) return unless should_fetch_email?(channel)
process_email_for_channel(channel) process_email_for_channel(channel)
rescue *ExceptionList::IMAP_EXCEPTIONS rescue *ExceptionList::IMAP_EXCEPTIONS => e
Rails.logger.error e
channel.authorization_error! channel.authorization_error!
rescue EOFError, OpenSSL::SSL::SSLError => e rescue EOFError, OpenSSL::SSL::SSLError, Net::IMAP::NoResponseError => e
Rails.logger.error e Rails.logger.error e
rescue StandardError => e rescue StandardError => e
ChatwootExceptionTracker.new(e, account: channel.account).capture_exception ChatwootExceptionTracker.new(e, account: channel.account).capture_exception

View File

@@ -12,7 +12,7 @@ module ExceptionList
].freeze ].freeze
IMAP_EXCEPTIONS = [ IMAP_EXCEPTIONS = [
Errno::ECONNREFUSED, Net::OpenTimeout, Net::IMAP::NoResponseError, Errno::ECONNREFUSED, Net::OpenTimeout,
Errno::ECONNRESET, Errno::ENETUNREACH, Net::IMAP::ByeResponseError, Errno::ECONNRESET, Errno::ENETUNREACH, Net::IMAP::ByeResponseError,
SocketError SocketError
].freeze ].freeze