Sha256: 88b0ff73b02652d7cfdc97ba778d60cb61fe696b560163d8265f4de68470118a
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
class AutoError::ErrorsController < AutoError::ApplicationController def show # reset action_controller.instance to the original controller # that caused the exception env['action_controller.instance'] = env.delete('auto_error.original_controller.instance') @exception = env['action_dispatch.exception'] @status_code = ActionDispatch::ExceptionWrapper.new(env, @exception).status_code @rescue_response = ActionDispatch::ExceptionWrapper.rescue_responses[@exception.class.name] @params = env['action_dispatch.request.parameters'].symbolize_keys @status_code = 500 unless [403, 404].include?(@status_code) if @status_code == 500 controller = "#{@params[:controller].camelize}Controller" rescue 'N/A' action = @params[:action] || 'N/A' where = { controller: controller, action: action } data = { path: env['REQUEST_URI'], method: env['REQUEST_METHOD'], ip: env['REMOTE_ADDR'] } AutoError::AppError.log!( env, @exception, where, data ) end AutoError::Config.error_template_renderer.bind(self).( @status_code ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
auto_error-0.0.3 | app/controllers/auto_error/errors_controller.rb |
auto_error-0.0.2 | app/controllers/auto_error/errors_controller.rb |