From e05714fdbc4d6a767f207b08a94ba3ebf147213e Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Sun, 16 Nov 2014 17:17:06 +0200 Subject: Don't let #{application,framework,full}_trace be nil Those three can be nil when exception backtrace is nil. This happens and that forced a couple of nil guards in the code. I'm proposing to make those always return an array, even on nil backtrace. --- .../middleware/templates/rescues/_source.erb | 38 ++++++++++------------ 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb') diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb index eabac3a9d2..101cea13f9 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb @@ -1,29 +1,27 @@ -<% if @source_extract %> - <% @source_extract.each_with_index do |extract_source, index| %> - <% if extract_source[:code] %> -
" id="frame-source-<%=index%>"> -
- Extracted source (around line #<%= extract_source[:line_number] %>): -
-
- - - +
-
-                  <% extract_source[:code].each_key do |line_number| %>
+<% @source_extract.each_with_index do |extract_source, index| %>
+  <% if extract_source[:code] %>
+    
" id="frame-source-<%=index%>"> +
+ Extracted source (around line #<%= extract_source[:line_number] %>): +
+
+ + + + <% end %> + + - -
+
+                <% extract_source[:code].each_key do |line_number| %>
 <%= line_number -%>
-                  <% end %>
-                
-
 <% extract_source[:code].each do |line, source| -%>
"><%= source -%>
<% end -%>
-
+
- <% end %> +
<% end %> <% end %> -- cgit v1.2.3 From 20ad04e5fcfd5b972bfffb6c47b44646c41b8a82 Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Mon, 3 Nov 2014 22:59:45 +0200 Subject: Rename #source_extract to #source_extracts in ExceptionWrapper It returns multiple source extracts since 1ed264bc. Also cleaned its result structure, as we no longer need the file in a code extract. --- .../action_dispatch/middleware/templates/rescues/_source.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb') diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb index 101cea13f9..e7b913bbe4 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb @@ -1,22 +1,22 @@ -<% @source_extract.each_with_index do |extract_source, index| %> - <% if extract_source[:code] %> +<% @source_extracts.each_with_index do |source_extract, index| %> + <% if source_extract[:code] %>
" id="frame-source-<%=index%>">
- Extracted source (around line #<%= extract_source[:line_number] %>): + Extracted source (around line #<%= source_extract[:line_number] %>):
-- cgit v1.2.3
-                <% extract_source[:code].each_key do |line_number| %>
+                <% source_extract[:code].each_key do |line_number| %>
 <%= line_number -%>
                 <% end %>
               
-<% extract_source[:code].each do |line, source| -%>
"><%= source -%>
<% end -%> +<% source_extract[:code].each do |line, source| -%>
"><%= source -%>
<% end -%>