mirror of
https://github.com/github/rails.git
synced 2026-02-07 12:44:54 -05:00
Tighten rescue clauses. Closes #5985.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4885 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,7 +7,7 @@ module ActionView
|
||||
begin
|
||||
Marshal::dump(object)
|
||||
"<pre class='debug_dump'>#{h(object.to_yaml).gsub(" ", " ")}</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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user