aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/template_error.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/template_error.rb b/actionpack/lib/action_view/template_error.rb
index ab05b3303f..0ac8ee4c37 100644
--- a/actionpack/lib/action_view/template_error.rb
+++ b/actionpack/lib/action_view/template_error.rb
@@ -28,7 +28,7 @@ module ActionView
end
end
- def source_extract
+ def source_extract(indention = 0)
source_code = IO.readlines(@file_name)
start_on_line = [ line_number - SOURCE_CODE_RADIUS - 1, 0 ].max
@@ -37,9 +37,9 @@ module ActionView
line_counter = start_on_line
extract = source_code[start_on_line..end_on_line].collect do |line|
line_counter += 1
- "#{line_counter}: " + line
+ "#{' ' * indention}#{line_counter}: " + line
end
-
+
extract.join
end
@@ -71,6 +71,13 @@ module ActionView
"\n\n"
end
+ def backtrace
+ [
+ "On line ##{line_number} of #{file_name}\n\n#{source_extract(4)}\n " +
+ clean_backtrace(original_exception).join("\n ")
+ ]
+ end
+
private
def strip_base_path(file_name)
file_name.gsub(@base_path, "")