diff --git a/README.md b/README.md index 24564f6d..475b36e4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Better Errors replaces the standard Rails error page with a much better and more useful error page. It is also usable outside of Rails in any Rack app as Rack middleware. -![image](http://i.imgur.com/urVDW.png) +![image](http://i.imgur.com/Me5of.png) ## Features diff --git a/lib/better_errors/code_formatter.rb b/lib/better_errors/code_formatter.rb index 582534f7..dcb2d4df 100644 --- a/lib/better_errors/code_formatter.rb +++ b/lib/better_errors/code_formatter.rb @@ -23,7 +23,7 @@ def html end def source_unavailable - "

Source unavailable

" + "

Source unavailable

" end def coderay_scanner diff --git a/lib/better_errors/stack_frame.rb b/lib/better_errors/stack_frame.rb index d0e124b4..0e68fa9b 100644 --- a/lib/better_errors/stack_frame.rb +++ b/lib/better_errors/stack_frame.rb @@ -53,6 +53,18 @@ def gem_path end end end + + def name_parts + @name_parts ||= name.match(/^(.*?)([\.\#].*)$/) + end + + def class_name + name_parts && name_parts[1] + end + + def method_name + name_parts && name_parts[2] + end def context if application? diff --git a/lib/better_errors/templates/main.erb b/lib/better_errors/templates/main.erb index c73910ac..dac3c108 100644 --- a/lib/better_errors/templates/main.erb +++ b/lib/better_errors/templates/main.erb @@ -3,229 +3,668 @@ <%= exception.class %> at <%= request_path %> -
-

<%= exception.class %> at <%= request_path %>

- - - - - - <% if backtrace_frames.any? %> - - - - - - - - - <% end %> -
Message<%= exception_message %>
File<%= backtrace_frames.first.filename %>
Line<%= backtrace_frames.first.line %>
+
+
+

<%= exception.class %> at <%= request_path %>

+

<%= exception_message %>

- + +
+
+ + <% backtrace_frames.each_with_index do |frame, index| %> <% end %> @@ -448,7 +900,11 @@ })(i); } - allFrames[0].click(); + // Click the first application frame + ( + document.querySelector(".frames li.application") || + document.querySelector(".frames li") + ).click(); var applicationFramesButton = document.getElementById("application_frames"); var allFramesButton = document.getElementById("all_frames"); diff --git a/lib/better_errors/templates/variable_info.erb b/lib/better_errors/templates/variable_info.erb index f0982049..0bee7584 100644 --- a/lib/better_errors/templates/variable_info.erb +++ b/lib/better_errors/templates/variable_info.erb @@ -1,13 +1,21 @@ +

Local Variables

+
<% @frame.local_variables.each do |name, value| %> <% end %>
<%= name %>
<%= value.inspect %>
+
+
+

Instance Variables

+
<% @frame.instance_variables.each do |name, value| %> <% end %>
<%= name %>
<%= value.inspect %>
+
+