mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	chore: Handle Sentry Errors (#2020)
If a contract contains an invalid email address, the sidekiq jobs for conversation continuity would error out. handling this exception gracefully.
This commit is contained in:
		| @@ -16,12 +16,19 @@ class ApplicationMailer < ActionMailer::Base | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   rescue_from(*ExceptionList::SMTP_EXCEPTIONS, with: :handle_smtp_exceptions) | ||||||
|  |  | ||||||
|   def smtp_config_set_or_development? |   def smtp_config_set_or_development? | ||||||
|     ENV.fetch('SMTP_ADDRESS', nil).present? || Rails.env.development? |     ENV.fetch('SMTP_ADDRESS', nil).present? || Rails.env.development? | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   private |   private | ||||||
|  |  | ||||||
|  |   def handle_smtp_exceptions(message) | ||||||
|  |     Rails.logger.info 'Failed to send Email' | ||||||
|  |     Rails.logger.info "Exception: #{message}" | ||||||
|  |   end | ||||||
|  |  | ||||||
|   def send_mail_with_liquid(*args) |   def send_mail_with_liquid(*args) | ||||||
|     mail(*args) do |format| |     mail(*args) do |format| | ||||||
|       # explored sending a multipart email containing both text type and html |       # explored sending a multipart email containing both text type and html | ||||||
|   | |||||||
| @@ -1,5 +1,8 @@ | |||||||
| module ExceptionList | module ExceptionList | ||||||
|   URI_EXCEPTIONS = [Errno::ETIMEDOUT, Errno::ECONNREFUSED, URI::InvalidURIError, Net::OpenTimeout, SocketError].freeze |   URI_EXCEPTIONS = [Errno::ETIMEDOUT, Errno::ECONNREFUSED, URI::InvalidURIError, Net::OpenTimeout, SocketError, OpenURI::HTTPError].freeze | ||||||
|   REST_CLIENT_EXCEPTIONS = [RestClient::NotFound, RestClient::GatewayTimeout, RestClient::BadRequest, |   REST_CLIENT_EXCEPTIONS = [RestClient::NotFound, RestClient::GatewayTimeout, RestClient::BadRequest, | ||||||
|                             RestClient::MethodNotAllowed, RestClient::Forbidden].freeze |                             RestClient::MethodNotAllowed, RestClient::Forbidden, RestClient::InternalServerError, RestClient::PayloadTooLarge].freeze | ||||||
|  |   SMTP_EXCEPTIONS = [ | ||||||
|  |     Net::SMTPSyntaxError | ||||||
|  |   ].freeze | ||||||
| end | end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sojan Jose
					Sojan Jose