From 0ffb6c16258b5c39a7417f4563edf0fc7542c9ae Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 6 Dec 2004 18:25:01 +0000 Subject: Syntax errors and other exceptions thrown outside of an action are now gracefully handled by the dispatcher git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@51 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_controller/templates/rescues/diagnostics.rhtml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml') diff --git a/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml b/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml index 4eb1ed0439..c9ea00ef8f 100644 --- a/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml +++ b/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml @@ -1,8 +1,6 @@ <% - base_dir = File.expand_path(File.dirname(__FILE__)) - - clean_backtrace = @exception.backtrace.collect { |line| line.gsub(base_dir, "").gsub("/../config/environments/../../", "") } - app_trace = clean_backtrace.reject { |line| line[0..6] == "vendor/" || line.include?("dispatch.cgi") } + clean_backtrace = @exception.backtrace.collect { |line| Object.const_defined?(:RAILS_ROOT) ? line.gsub(RAILS_ROOT, "") : line } + app_trace = clean_backtrace.reject { |line| line =~ /(vendor|dispatch|ruby)/ } framework_trace = clean_backtrace - app_trace %> @@ -10,9 +8,9 @@ <%=h @exception.class.to_s %> in <%=h @request.parameters["controller"].capitalize %>#<%=h @request.parameters["action"] %> -

<%=h @exception.message %>

+

<%=h Object.const_defined?(:RAILS_ROOT) ? @exception.message.gsub(RAILS_ROOT, "") : @exception.message %>

-<% unless app_trace.empty? %>
<%=h app_trace.collect { |line| line.gsub("/../", "") }.join("\n") %>
<% end %> +<% unless app_trace.empty? %>
<%=h app_trace.join("\n") %>
<% end %> <% unless framework_trace.empty? %> Show framework trace -- cgit v1.2.3