class ActionDispatch::ExceptionWrapper

Attributes

env[R]
exception[R]

Public Class Methods

new(env, exception) click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 27
def initialize(env, exception)
  @env = env
  @exception = original_exception(exception)
end
status_code_for_exception(class_name) click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 52
def self.status_code_for_exception(class_name)
  Rack::Utils.status_code(@@rescue_responses[class_name])
end

Public Instance Methods

application_trace() click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 40
def application_trace
  clean_backtrace(:silent)
end
framework_trace() click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 44
def framework_trace
  clean_backtrace(:noise)
end
full_trace() click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 48
def full_trace
  clean_backtrace(:all)
end
rescue_template() click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 32
def rescue_template
  @@rescue_templates[@exception.class.name]
end
status_code() click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 36
def status_code
  self.class.status_code_for_exception(@exception.class.name)
end

Private Instance Methods

backtrace_cleaner() click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 78
def backtrace_cleaner
  @backtrace_cleaner ||= @env['action_dispatch.backtrace_cleaner']
end
clean_backtrace(*args) click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 70
def clean_backtrace(*args)
  if backtrace_cleaner
    backtrace_cleaner.clean(@exception.backtrace, *args)
  else
    @exception.backtrace
  end
end
original_exception(exception) click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 58
def original_exception(exception)
  if registered_original_exception?(exception)
    exception.original_exception
  else
    exception
  end
end
registered_original_exception?(exception) click to toggle source
# File lib/action_dispatch/middleware/exception_wrapper.rb, line 66
def registered_original_exception?(exception)
  exception.respond_to?(:original_exception) && @@rescue_responses.has_key?(exception.original_exception.class.name)
end