From 31a499ac2713e3fbacda32de037f4af419152658 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 7 Mar 2006 07:27:54 +0000 Subject: [PATCH] Added a backtrace to the evil WSOD (White Screen of Death). Closes #4073. TODO: Clearer exceptions [Rick Olson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3809 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 2 ++ railties/lib/dispatcher.rb | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 3a0b3ce5e0..26a9057cf5 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added a backtrace to the evil WSOD (White Screen of Death). Closes #4073. TODO: Clearer exceptions [Rick Olson] + * Added tracking of database and framework versions in script/about #4088 [charles.gerungan@gmail.com/Rick Olson] * Added public/javascripts/application.js as a sample since it'll automatically be included in javascript_include_tag :defaults [DHH] diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index d4f644ecc9..f3350087ad 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -38,7 +38,7 @@ class Dispatcher ActionController::Routing::Routes.recognize!(request).process(request, response).out(output) end rescue Object => exception - failsafe_response(output, '500 Internal Server Error') do + failsafe_response(output, '500 Internal Server Error', exception) do ActionController::Base.process_with_exception(request, response, exception).out(output) end ensure @@ -85,11 +85,13 @@ class Dispatcher end # If the block raises, send status code as a last-ditch response. - def failsafe_response(output, status) + def failsafe_response(output, status, exception) yield rescue Object begin output.write "Status: #{status}\r\n" + output.write "Content-Type: text/plain\r\n\r\n" + output.write exception.to_s + "\r\n" + exception.backtrace.join("\r\n") rescue Object end end