aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb12
-rw-r--r--actionpack/lib/action_view/template/error.rb5
2 files changed, 6 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
index 12a93d6a24..2dd2ec9fe9 100644
--- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -133,14 +133,10 @@ module ActionDispatch
return unless logger
ActiveSupport::Deprecation.silence do
- if ActionView::Template::Error === exception
- logger.fatal(exception.to_s)
- else
- logger.fatal(
- "\n#{exception.class} (#{exception.message}):\n " +
- clean_backtrace(exception).join("\n ") + "\n\n"
- )
- end
+ message = "\n#{exception.class} (#{exception.message}):\n"
+ message << exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
+ message << exception.backtrace.join("\n ")
+ logger.fatal("#{message}\n\n")
end
end
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb
index a947d746e3..6866eabf77 100644
--- a/actionpack/lib/action_view/template/error.rb
+++ b/actionpack/lib/action_view/template/error.rb
@@ -84,9 +84,8 @@ module ActionView
end
end
- def to_s
- "\n#{self.class} (#{message}) #{source_location}:\n\n" +
- "#{source_extract(4)}\n #{backtrace.join("\n ")}\n\n"
+ def annoted_source_code
+ source_extract(4)
end
private