aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-08-31 03:16:28 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-08-31 03:16:28 +0000
commit12ff554cd476bd2c653d9fd331bbcabb71363f3a (patch)
treecba0755d5ae3731380370af405e4f7e51490b27c /railties/lib
parent785e1fa599050513f8d0b235338c771f04dcf422 (diff)
downloadrails-12ff554cd476bd2c653d9fd331bbcabb71363f3a.tar.gz
rails-12ff554cd476bd2c653d9fd331bbcabb71363f3a.tar.bz2
rails-12ff554cd476bd2c653d9fd331bbcabb71363f3a.zip
Tighten rescue clauses. Closes #5985.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4885 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/dispatcher.rb6
-rw-r--r--railties/lib/fcgi_handler.rb6
2 files changed, 6 insertions, 6 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index 78f2d9fe43..a93ccb146d 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -40,7 +40,7 @@ class Dispatcher
controller = ActionController::Routing::Routes.recognize(request)
controller.process(request, response).out(output)
end
- rescue Object => exception
+ rescue Exception => exception # errors from CGI dispatch
failsafe_response(output, '500 Internal Server Error', exception) do
controller ||= const_defined?(:ApplicationController) ? ApplicationController : ActionController::Base
controller.process_with_exception(request, response, exception).out(output)
@@ -129,7 +129,7 @@ class Dispatcher
# If the block raises, send status code as a last-ditch response.
def failsafe_response(output, status, exception = nil)
yield
- rescue Object
+ rescue Exception # errors from executed block
begin
output.write "Status: #{status}\r\n"
@@ -152,7 +152,7 @@ class Dispatcher
output.write(message)
end
end
- rescue Object
+ rescue Exception # Logger or IO errors
end
end
end
diff --git a/railties/lib/fcgi_handler.rb b/railties/lib/fcgi_handler.rb
index 10f846fa13..7b5aafe122 100644
--- a/railties/lib/fcgi_handler.rb
+++ b/railties/lib/fcgi_handler.rb
@@ -76,7 +76,7 @@ class RailsFCGIHandler
rescue SystemExit => exit_error
dispatcher_log :info, "terminated by explicit exit"
- rescue Object => fcgi_error
+ rescue Exception => fcgi_error # FCGI errors
# retry on errors that would otherwise have terminated the FCGI process,
# but only if they occur more than 10 seconds apart.
if !(SignalException === fcgi_error) && Time.now - @last_error_on > 10
@@ -97,7 +97,7 @@ class RailsFCGIHandler
def dispatcher_log(level, msg)
time_str = Time.now.strftime("%d/%b/%Y:%H:%M:%S")
logger.send(level, "[#{time_str} :: #{$$}] #{msg}")
- rescue Object => log_error
+ rescue Exception => log_error # Logger errors
STDERR << "Couldn't write to #{@log_file_path.inspect}: #{msg}\n"
STDERR << " #{log_error.class}: #{log_error.message}\n"
end
@@ -148,7 +148,7 @@ class RailsFCGIHandler
def process_request(cgi)
Dispatcher.dispatch(cgi)
- rescue Object => e
+ rescue Exception => e # errors from CGI dispatch
raise if SignalException === e
dispatcher_error(e)
end