diff --git a/config/environments/production.rb b/config/environments/production.rb index 0f684b3b75..afa31643d6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -124,13 +124,22 @@ exception_notifier_prefix << "[#{ AlaveteliConfiguration.domain }] " end - if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank? + notify_exceptions = + AlaveteliConfiguration.exception_notifications_from.present? && + AlaveteliConfiguration.exception_notifications_to.present? + + if notify_exceptions + ignored_exceptions = %w( + ActionController::BadRequest + ActionDispatch::Http::MimeNegotiation::InvalidType + ) + ExceptionNotifier.ignored_exceptions + middleware.use ExceptionNotification::Rack, - :ignore_exceptions => ['ActionController::BadRequest'] + ExceptionNotifier.ignored_exceptions, - :email => { - :email_prefix => exception_notifier_prefix, - :sender_address => AlaveteliConfiguration.exception_notifications_from, - :exception_recipients => AlaveteliConfiguration.exception_notifications_to + ignore_exceptions: ignored_exceptions, + email: { + email_prefix: exception_notifier_prefix, + sender_address: AlaveteliConfiguration.exception_notifications_from, + exception_recipients: AlaveteliConfiguration.exception_notifications_to } end