app/controllers/application_controller.rb
# Overrides ActionController::Rescue rescue_action_in_public to render custom views instead of static HTML pages
# public/404.html and public/500.html. Static pages are still used if exception prevents reaching controller
# e.g. see ActionController::Failsafe which catches e.g. MySQL exceptions such as database unknown
Overrides ActionController::Rescue rescue_action_in_public to render custom views instead of static HTML pages
public/404.html and public/500.html. Static pages are still used if exception prevents reaching controller
e.g. see ActionController::Failsafe which catches e.g. MySQL exceptions such as database unknown
Overrides ActionController :: Rescue rescue_action_in_public to render custom views instead of static HTML pages public / 404 . html and public / 500 . html . Static pages are still used if exception prevents reaching controller e . g . see ActionController :: Failsafe which catches e . g . MySQL exceptions such as database unknown
def rescue_action_in_public(exception)
    status_code     = ActionDispatch::ExceptionWrapper.new(env, exception).status_code
    response_code   = ActionDispatch::ExceptionWrapper.rescue_responses[exception.class.name]
    if exception.class == ActionView::MissingTemplate
      status_code = 404
      response_code = :not_found
    end
    render_exception_response(exception, response_code, status_code)
    if ! $IGNORED_EXCEPTIONS.include?(exception.to_s) &&
       ! $IGNORED_EXCEPTION_CLASSES.include?(exception.class.to_s)
      user_id = logged_in? ? current_user.id : 0
      EOL.log("ERROR: #{env['REQUEST_URI']} (user #{user_id})", prefix: "*")
      EOL.log_error(exception)
      NewRelic::Agent.notice_error(exception) if $PRODUCTION_MODE
    end
  end
def rescue_action_in_public ( exception ) status_code = ActionDispatch :: ExceptionWrapper . new ( env , exception ) . status_code response_code = ActionDispatch :: ExceptionWrapper . rescue_responses [ exception . class . name ] if exception . class == ActionView :: MissingTemplate status_code = 404 response_code = :not_found end render_exception_response ( exception , response_code , status_code ) if ! $IGNORED_EXCEPTIONS . include? ( exception . to_s ) && ! $IGNORED_EXCEPTION_CLASSES . include? ( exception . class . to_s ) user_id = logged_in? ? current_user . id : 0 EOL . log ( "ERROR: #{env['REQUEST_URI']} (user #{user_id})" , prefix : "*" ) EOL . log_error ( exception ) NewRelic :: Agent . notice_error ( exception ) if $PRODUCTION_MODE end end
Overrides ActionController::Rescue rescue_action_in_public to render custom views instead of static HTML pages
public/404.html and public/500.html.
Overrides ActionController :: Rescue rescue_action_in_public to render custom views instead of static HTML pages public / 404 . html and public / 500 . html .
# Log to database # Notify New Relic about exception
exception
<not_specific>