Skip to content

Commit

Permalink
Log minor application errors to separate log file
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-hank committed Aug 31, 2022
1 parent 9dbe9cc commit c741d44
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ class ApplicationController < ActionController::Base
after_action :include_auth_cookie

if Rails.env.staging? || Rails.env.production?
[ActiveRecord::RecordNotFound, ActionController::RoutingError, ActionController::UnknownFormat].each do |exception_class|
[
ActiveRecord::RecordNotFound,
ActionController::RoutingError,
ActionController::UnknownFormat,
ActionController::UnknownHttpMethod,
ActionController::BadRequest,
ActionController::InvalidAuthenticityToken,
ActionController::InvalidCrossOriginRequest,
ActionController::MethodNotAllowed,
ActionController::NotImplemented,
ActionController::ParameterMissing,
ActionDispatch::Http::MimeNegotiation::InvalidType,
ActionDispatch::Http::Parameters::ParseError
].each do |exception_class|
rescue_from exception_class do |exception|
resource_not_found(exception)
end
Expand Down

0 comments on commit c741d44

Please sign in to comment.