Skip to content

Commit

Permalink
Exclude Mime::Type::InvalidMimeType exception
Browse files Browse the repository at this point in the history
After upgrading `frontend` to rails 6, we started seeing this error:
`Mime::Type::InvalidMimeType "charset=utf-8" is not a valid MIME type`
Example here:
https://sentry.io/organizations/govuk/issues/1549200925/?end=2020-03-06T12%3A00%3A23&environment=staging&project=202225&query=is%3Aunresolved+url%3Ahttps%3A%2F%2Fwww-origin.staging.govuk.digital%2Freport-an-unregistered-trader-or-business&start=2020-03-05T16%3A07%3A23&utc=true

This is because, even though these errors are rescued by ActionDispatch,
they still reach Sentry. Here's the explanation from Sentry's docs:
> Rails catches exceptions in the ActionDispatch::ShowExceptions or
> ActionDispatch::DebugExceptions middlewares, depending on the
> environment. When rails_report_rescued_exceptions is true (it is by
> default), Raven will report exceptions even when they are rescued by
> these middlewares.

So, in order to stop this behaviour, we set this option to be false for
`frontend` in this PR: alphagov/frontend#2264

We also want to explicitly add `Mime::Type::InvalidMimeType` to the list
of excluded exceptions, hence this PR.

Trello card: https://trello.com/c/Ik7ulDXQ/1768-3-upgrade-frontend-to-rails-6
  • Loading branch information
Alan Gabbianelli committed Mar 6, 2020
1 parent 6c050a5 commit c75fb5f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/govuk_app_config/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'CGI::Session::CookieStore::TamperedWithCookie',
'GdsApi::HTTPIntermittentServerError',
'GdsApi::TimedOutException',
'Mime::Type::InvalidMimeType',
'Mongoid::Errors::DocumentNotFound',
'Sinatra::NotFound',
]
Expand Down

0 comments on commit c75fb5f

Please sign in to comment.