From 12ff554cd476bd2c653d9fd331bbcabb71363f3a Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 31 Aug 2006 03:16:28 +0000 Subject: Tighten rescue clauses. Closes #5985. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4885 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/dispatcher.rb | 6 +++--- railties/lib/fcgi_handler.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'railties/lib') 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 -- cgit v1.2.3