aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionmailer/CHANGELOG2
-rw-r--r--actionmailer/lib/action_mailer/base.rb2
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/caching.rb2
-rwxr-xr-xactionpack/lib/action_controller/cgi_ext/cgi_methods.rb2
-rw-r--r--actionpack/lib/action_controller/dependencies.rb2
-rw-r--r--actionpack/lib/action_controller/rescue.rb2
-rw-r--r--actionpack/lib/action_view/base.rb2
-rw-r--r--actionpack/lib/action_view/compiled_templates.rb2
-rw-r--r--actionpack/lib/action_view/helpers/debug_helper.rb2
-rw-r--r--actionpack/test/active_record_unit.rb8
-rw-r--r--actionwebservice/CHANGELOG2
-rw-r--r--actionwebservice/test/abstract_unit.rb2
-rw-r--r--activerecord/CHANGELOG2
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/dependencies.rb4
-rw-r--r--activesupport/test/core_ext/exception_test.rb2
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/dispatcher.rb6
-rw-r--r--railties/lib/fcgi_handler.rb6
20 files changed, 34 insertions, 22 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG
index 267a6265f5..53830283f8 100644
--- a/actionmailer/CHANGELOG
+++ b/actionmailer/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
* Automatically included ActionController::UrlWriter, such that URL generation can happen within ActionMailer controllers. [DHH]
* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 6143121519..7045fddb1b 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -396,7 +396,7 @@ module ActionMailer #:nodoc:
begin
send("perform_delivery_#{delivery_method}", mail) if perform_deliveries
- rescue Object => e
+ rescue Exception => e # Net::SMTP errors or sendmail pipe errors
raise e if raise_delivery_errors
end
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 281c0a85e4..362804d128 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
* Fix send_data documentation typo. #5982 [brad@madriska.com]
* Switch to using FormEncodedPairParser for parsing request parameters. [Nicholas Seckar, DHH]
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb
index 5461a2eadd..7eecb15e9b 100644
--- a/actionpack/lib/action_controller/caching.rb
+++ b/actionpack/lib/action_controller/caching.rb
@@ -487,7 +487,7 @@ module ActionController #:nodoc:
if f =~ matcher
begin
File.delete(f)
- rescue Object => e
+ rescue SystemCallError => e
# If there's no cache, then there's nothing to complain about
end
end
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
index bb7be80560..6cb38a38f3 100755
--- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
+++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
@@ -55,7 +55,7 @@ class CGIMethods #:nodoc:
node = XmlNode.from_xml(raw_post_data)
{ node.node_name => node }
end
- rescue Object => e
+ rescue Exception => e # YAML, XML or Ruby code block errors
{ "exception" => "#{e.message} (#{e.class})", "backtrace" => e.backtrace,
"raw_post_data" => raw_post_data, "format" => mime_type }
end
diff --git a/actionpack/lib/action_controller/dependencies.rb b/actionpack/lib/action_controller/dependencies.rb
index 0f4c16cad4..d316552f49 100644
--- a/actionpack/lib/action_controller/dependencies.rb
+++ b/actionpack/lib/action_controller/dependencies.rb
@@ -71,7 +71,7 @@ module ActionController #:nodoc:
require_dependency(dependency.to_s)
rescue LoadError => e
raise LoadError.new("Missing #{layer} #{dependency}.rb").copy_blame!(e)
- rescue Object => exception
+ rescue Exception => exception # error from loaded file
exception.blame_file! "=> #{layer} #{dependency}.rb"
raise
end
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index 7cd05eab32..dd670fe96d 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -78,7 +78,7 @@ module ActionController #:nodoc:
def perform_action_with_rescue #:nodoc:
begin
perform_action_without_rescue
- rescue Object => exception
+ rescue Exception => exception # errors from action performed
if defined?(Breakpoint) && params["BP-RETRY"]
msg = exception.backtrace.first
if md = /^(.+?):(\d+)(?::in `(.+)')?$/.match(msg) then
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index b38501359c..f3e2347d45 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -510,7 +510,7 @@ module ActionView #:nodoc:
else
CompiledTemplates.module_eval(render_source, 'compiled-template', -line_offset)
end
- rescue Object => e
+ rescue Exception => e # errors from template code
if logger
logger.debug "ERROR: compiling #{render_symbol} RAISED #{e}"
logger.debug "Function body: #{render_source}"
diff --git a/actionpack/lib/action_view/compiled_templates.rb b/actionpack/lib/action_view/compiled_templates.rb
index a00a7578bb..deb730f4da 100644
--- a/actionpack/lib/action_view/compiled_templates.rb
+++ b/actionpack/lib/action_view/compiled_templates.rb
@@ -55,7 +55,7 @@ module ActionView
begin
module_eval(method_def, fake_file_name, initial_line_number)
@mtimes[full_key(identifier, arg_names)] = Time.now
- rescue Object => e
+ rescue Exception => e # errors from compiled source
e.blame_file! identifier
raise
end
diff --git a/actionpack/lib/action_view/helpers/debug_helper.rb b/actionpack/lib/action_view/helpers/debug_helper.rb
index 8baea6f450..9e92813a18 100644
--- a/actionpack/lib/action_view/helpers/debug_helper.rb
+++ b/actionpack/lib/action_view/helpers/debug_helper.rb
@@ -7,7 +7,7 @@ module ActionView
begin
Marshal::dump(object)
"<pre class='debug_dump'>#{h(object.to_yaml).gsub(" ", "&nbsp; ")}</pre>"
- rescue Object => e
+ rescue Exception => e # errors from Marshal or YAML
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback
"<code class='debug_dump'>#{h(object.inspect)}</code>"
end
diff --git a/actionpack/test/active_record_unit.rb b/actionpack/test/active_record_unit.rb
index 1a17977ff5..2555eb7c1a 100644
--- a/actionpack/test/active_record_unit.rb
+++ b/actionpack/test/active_record_unit.rb
@@ -17,12 +17,12 @@ else
$stderr.print 'Attempting to load Active Record... '
begin
PATH_TO_AR = "#{File.dirname(__FILE__)}/../../activerecord/lib"
- raise "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR)
+ raise LoadError, "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR)
$LOAD_PATH.unshift PATH_TO_AR
require 'active_record'
require 'active_record/fixtures'
$stderr.puts 'success'
- rescue Object => e
+ rescue LoadError => e
$stderr.print "failed. Skipping Active Record assertion tests: #{e}"
ActiveRecordTestConnector.able_to_connect = false
end
@@ -41,7 +41,7 @@ class ActiveRecordTestConnector
require_fixture_models
self.connected = true
end
- rescue Object => e
+ rescue Exception => e # errors from ActiveRecord setup
$stderr.puts "\nSkipping ActiveRecord assertion tests: #{e}"
#$stderr.puts " #{e.backtrace.join("\n ")}\n"
self.able_to_connect = false
@@ -56,7 +56,7 @@ class ActiveRecordTestConnector
ActiveRecord::Base.establish_connection(connection_options)
ActiveRecord::Base.configurations = { 'sqlite3_ar_integration' => connection_options }
ActiveRecord::Base.connection
- rescue Object
+ rescue Exception # errors from establishing a connection
$stderr.puts 'SQLite 3 unavailable; falling to SQLite 2.'
connection_options = {:adapter => 'sqlite', :dbfile => ':memory:'}
ActiveRecord::Base.establish_connection(connection_options)
diff --git a/actionwebservice/CHANGELOG b/actionwebservice/CHANGELOG
index d0c3a0a73b..5a98b032d2 100644
--- a/actionwebservice/CHANGELOG
+++ b/actionwebservice/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
* Fixed XMLRPC multicall when one of the called methods returns a struct object. [Kent Sibilev]
* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
diff --git a/actionwebservice/test/abstract_unit.rb b/actionwebservice/test/abstract_unit.rb
index 3afd928561..3c5a973498 100644
--- a/actionwebservice/test/abstract_unit.rb
+++ b/actionwebservice/test/abstract_unit.rb
@@ -16,7 +16,7 @@ begin
PATH_TO_AR = File.dirname(__FILE__) + '/../../activerecord'
require "#{PATH_TO_AR}/lib/active_record" unless Object.const_defined?(:ActiveRecord)
require "#{PATH_TO_AR}/lib/active_record/fixtures" unless Object.const_defined?(:Fixtures)
-rescue Object => e
+rescue LoadError => e
fail "\nFailed to load activerecord: #{e}"
end
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index db5bd52867..89b06c6df8 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
* Fix spurious newlines and spaces in AR::Base#to_xml output [Jamis Buck]
* has_one supports the :dependent => :delete option which skips the typical callback chain and deletes the associated object directly from the database. #5927 [Chris Mear, Jonathan Viney]
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index bcf2860c53..1d15c27fef 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
* Inflections: don't singularize -ies plurals. [foamdino@gmail.com, Mark Van Holstyn]
* Update Initializer to use load_once_paths to avoid plugin reloading. References #5852. [Nicholas Seckar]
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index ca418fe500..7a74884dc7 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -341,14 +341,14 @@ end
class Object #:nodoc:
def load(file, *extras)
super(file, *extras)
- rescue Object => exception
+ rescue Exception => exception # errors from loading file
exception.blame_file! file
raise
end
def require(file, *extras)
super(file, *extras)
- rescue Object => exception
+ rescue Exception => exception # errors from required file
exception.blame_file! file
raise
end
diff --git a/activesupport/test/core_ext/exception_test.rb b/activesupport/test/core_ext/exception_test.rb
index 952ac04e2e..b1ea564a0c 100644
--- a/activesupport/test/core_ext/exception_test.rb
+++ b/activesupport/test/core_ext/exception_test.rb
@@ -4,7 +4,7 @@ class ExceptionExtTests < Test::Unit::TestCase
def get_exception(cls = RuntimeError, msg = nil, trace = nil)
begin raise cls, msg, (trace || caller)
- rescue Object => e
+ rescue Exception => e # passed Exception
return e
end
end
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 3f9068257a..ae4d48df0c 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
* Cleaning up tests. [Kevin Clark, Jeremy Kemper]
* Add Dependencies.load_once_paths. [Nicholas Seckar]
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