1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Rick Olson 2006-03-07 07:27:54 +00:00
parent 6fd737b76b
commit 31a499ac27
2 changed files with 6 additions and 2 deletions

View file

@ -1,5 +1,7 @@
*SVN* *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 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] * Added public/javascripts/application.js as a sample since it'll automatically be included in javascript_include_tag :defaults [DHH]

View file

@ -38,7 +38,7 @@ class Dispatcher
ActionController::Routing::Routes.recognize!(request).process(request, response).out(output) ActionController::Routing::Routes.recognize!(request).process(request, response).out(output)
end end
rescue Object => exception 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) ActionController::Base.process_with_exception(request, response, exception).out(output)
end end
ensure ensure
@ -85,11 +85,13 @@ class Dispatcher
end end
# If the block raises, send status code as a last-ditch response. # If the block raises, send status code as a last-ditch response.
def failsafe_response(output, status) def failsafe_response(output, status, exception)
yield yield
rescue Object rescue Object
begin begin
output.write "Status: #{status}\r\n" 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 rescue Object
end end
end end