Browse files

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
  • Loading branch information...
1 parent 6fd737b commit 31a499ac2713e3fbacda32de037f4af419152658 @technoweenie technoweenie committed Mar 7, 2006
Showing with 6 additions and 2 deletions.
  1. +2 −0 railties/CHANGELOG
  2. +4 −2 railties/lib/dispatcher.rb
View
2 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]
View
6 railties/lib/dispatcher.rb
@@ -38,7 +38,7 @@ def dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_
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 @@ def prepare_breakpoint
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

0 comments on commit 31a499a

Please sign in to comment.