diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-06 15:59:30 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-06 15:59:44 -0700 |
commit | 6d85804bc6aeecce5669fb4b0d7b33c069deff3a (patch) | |
tree | 42bdaacb3eae5795b21f0144716949435e44e092 /actionpack/lib/action_dispatch/middleware/exception_wrapper.rb | |
parent | 38251d2e33ccdfeee7ddbeeba5737c2a36911606 (diff) | |
download | rails-6d85804bc6aeecce5669fb4b0d7b33c069deff3a.tar.gz rails-6d85804bc6aeecce5669fb4b0d7b33c069deff3a.tar.bz2 rails-6d85804bc6aeecce5669fb4b0d7b33c069deff3a.zip |
ExceptionWrapper doesn't need to know about `env`
ExceptionWrapper only cares about the backtrace cleaner, so lets just
pass the cleaner to the wrapper. It does not need to know that env
exists or what key the backtrace cleaner is stored in
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/exception_wrapper.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/exception_wrapper.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb index 8c3d45584d..039efc3af8 100644 --- a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +++ b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb @@ -31,10 +31,10 @@ module ActionDispatch 'ActionView::Template::Error' => 'template_error' ) - attr_reader :env, :exception, :line_number, :file + attr_reader :backtrace_cleaner, :exception, :line_number, :file - def initialize(env, exception) - @env = env + def initialize(backtrace_cleaner, exception) + @backtrace_cleaner = backtrace_cleaner @exception = original_exception(exception) expand_backtrace if exception.is_a?(SyntaxError) || exception.try(:original_exception).try(:is_a?, SyntaxError) @@ -125,10 +125,6 @@ module ActionDispatch end end - def backtrace_cleaner - @backtrace_cleaner ||= @env['action_dispatch.backtrace_cleaner'] - end - def source_fragment(path, line) return unless Rails.respond_to?(:root) && Rails.root full_path = Rails.root.join(path) |