Class: AutoError::ErrorsController
Instance Method Summary
collapse
#js_namespace, #void_path
Instance Method Details
#show ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/auto_error/errors_controller.rb', line 3
def show
env['PATH_INFO'] = env['ORIGINAL_FULLPATH']
env['action_controller.instance'] = env.delete('auto_error.original_controller.instance')
@controller = env['action_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]
@status_code = 500 unless [403, 404].include?(@status_code)
if @status_code == 500
@request = @controller.request
@params = @request.filtered_parameters.symbolize_keys
controller = "#{@params[:controller].camelize}Controller" rescue 'N/A'
action = @params[:action] || 'N/A'
where = { controller: controller, action: action }
data = {
path: @request.fullpath.split('?').first,
method: @request.method,
ip: @request.remote_ip,
params: @params.except( *(%w{
controller action format _method only_path
}.map(&:to_sym) ) )
}
AutoError::AppError.log!( env, @exception, where, data )
end
AutoError::Config.error_template_renderer.bind(self).( @status_code )
rescue => explosion
Rails.logger.error "\nAutoError exploded while handling an exception: #{@exception.inspect}\nHere's the error: #{explosion.inspect}\n"
end
|