diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-06 18:25:01 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-06 18:25:01 +0000 |
commit | 0ffb6c16258b5c39a7417f4563edf0fc7542c9ae (patch) | |
tree | 2242cb28635f99410268f48d0415e97b4c5a5de1 /actionpack/lib/action_controller/templates | |
parent | ed14042feac6ff84670958fc3e2017aaacac5856 (diff) | |
download | rails-0ffb6c16258b5c39a7417f4563edf0fc7542c9ae.tar.gz rails-0ffb6c16258b5c39a7417f4563edf0fc7542c9ae.tar.bz2 rails-0ffb6c16258b5c39a7417f4563edf0fc7542c9ae.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller/templates')
3 files changed, 5 insertions, 17 deletions
diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml index f1b4a2a1dd..d1703b0440 100644 --- a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml +++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml @@ -1,6 +1,4 @@ <% - base_dir = File.expand_path(File.dirname(__FILE__)) - request_parameters_without_action = @request.parameters.clone request_parameters_without_action.delete("action") request_parameters_without_action.delete("controller") 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"] %> </h1> -<p><%=h @exception.message %></p> +<p><%=h Object.const_defined?(:RAILS_ROOT) ? @exception.message.gsub(RAILS_ROOT, "") : @exception.message %></p> -<% unless app_trace.empty? %><pre><code><%=h app_trace.collect { |line| line.gsub("/../", "") }.join("\n") %></code></pre><% end %> +<% unless app_trace.empty? %><pre><code><%=h app_trace.join("\n") %></code></pre><% end %> <% unless framework_trace.empty? %> <a href="#" onclick="document.getElementById('framework_trace').style.display='block'; return false;">Show framework trace</a> diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml index 326fd0b057..405a2e070a 100644 --- a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml +++ b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml @@ -1,11 +1,3 @@ -<% - base_dir = File.expand_path(File.dirname(__FILE__)) - - framework_trace = @exception.original_exception.backtrace.collect do |line| - line.gsub(base_dir, "").gsub("/../config/environments/../../", "") - end -%> - <h1> <%=h @exception.original_exception.class.to_s %> in <%=h @request.parameters["controller"].capitalize %>#<%=h @request.parameters["action"] %> @@ -21,6 +13,6 @@ <p><%=h @exception.sub_template_message %></p> <a href="#" onclick="document.getElementById('framework_trace').style.display='block'">Show template trace</a> -<pre id="framework_trace" style="display:none"><code><%=h framework_trace.join("\n") %></code></pre> +<pre id="framework_trace" style="display:none"><code><%=h @exception.original_exception.backtrace.collect { |line| Object.const_defined?(:RAILS_ROOT) ? line.gsub(RAILS_ROOT, "") : line }.join("\n") %></code></pre> <%= render_file(@rescues_path + "/_request_and_response.rhtml", false) %> |