Skip to content

Commit

Permalink
Merge branch '6553-ignore-invalid-mime-negotiation' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Oct 11, 2021
2 parents 37f9239 + 1b6eb8f commit 3d3a388
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3d3a388

Please sign in to comment.