Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4885

Show
Ignore:
Timestamp:
08/31/06 03:16:28 (2 years ago)
Author:
bitsweat
Message:

Tighten rescue clauses. Closes #5985.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionmailer/CHANGELOG

    r4818 r4885  
    11*SVN* 
     2 
     3* Tighten rescue clauses.  #5985 [james@grayproductions.net] 
    24 
    35* Automatically included ActionController::UrlWriter, such that URL generation can happen within ActionMailer controllers. [DHH] 
  • trunk/actionmailer/lib/action_mailer/base.rb

    r4818 r4885  
    397397      begin 
    398398        send("perform_delivery_#{delivery_method}", mail) if perform_deliveries 
    399       rescue Object => e 
     399      rescue Exception => e  # Net::SMTP errors or sendmail pipe errors 
    400400        raise e if raise_delivery_errors 
    401401      end 
  • trunk/actionpack/CHANGELOG

    r4884 r4885  
    11*SVN* 
     2 
     3* Tighten rescue clauses.  #5985 [james@grayproductions.net] 
    24 
    35* Fix send_data documentation typo.  #5982 [brad@madriska.com] 
  • trunk/actionpack/lib/action_controller/caching.rb

    r4740 r4885  
    488488              begin 
    489489                File.delete(f) 
    490               rescue Object => e 
     490              rescue SystemCallError => e 
    491491                # If there's no cache, then there's nothing to complain about 
    492492              end 
  • trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb

    r4866 r4885  
    5656          { node.node_name => node } 
    5757      end 
    58     rescue Object => e 
     58    rescue Exception => e # YAML, XML or Ruby code block errors 
    5959      { "exception" => "#{e.message} (#{e.class})", "backtrace" => e.backtrace,  
    6060        "raw_post_data" => raw_post_data, "format" => mime_type } 
  • trunk/actionpack/lib/action_controller/dependencies.rb

    r4310 r4885  
    7272            rescue LoadError => e 
    7373              raise LoadError.new("Missing #{layer} #{dependency}.rb").copy_blame!(e) 
    74             rescue Object => exception 
     74            rescue Exception => exception  # error from loaded file 
    7575              exception.blame_file! "=> #{layer} #{dependency}.rb" 
    7676              raise 
  • trunk/actionpack/lib/action_controller/rescue.rb

    r4715 r4885  
    7979        begin 
    8080          perform_action_without_rescue 
    81         rescue Object => exception 
     81        rescue Exception => exception  # errors from action performed 
    8282          if defined?(Breakpoint) && params["BP-RETRY"] 
    8383            msg = exception.backtrace.first 
  • trunk/actionpack/lib/action_view/base.rb

    r4715 r4885  
    511511            CompiledTemplates.module_eval(render_source, 'compiled-template', -line_offset) 
    512512          end 
    513         rescue Object =>
     513        rescue Exception => e  # errors from template cod
    514514          if logger 
    515515            logger.debug "ERROR: compiling #{render_symbol} RAISED #{e}" 
  • trunk/actionpack/lib/action_view/compiled_templates.rb

    r4079 r4885  
    5656        module_eval(method_def, fake_file_name, initial_line_number) 
    5757        @mtimes[full_key(identifier, arg_names)] = Time.now 
    58       rescue Object =>
     58      rescue Exception => e  # errors from compiled sourc
    5959        e.blame_file! identifier 
    6060        raise 
  • trunk/actionpack/lib/action_view/helpers/debug_helper.rb

    r4 r4885  
    88          Marshal::dump(object) 
    99          "<pre class='debug_dump'>#{h(object.to_yaml).gsub("  ", "&nbsp; ")}</pre>" 
    10         rescue Object => e 
     10        rescue Exception => e  # errors from Marshal or YAML 
    1111          # Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback 
    1212          "<code class='debug_dump'>#{h(object.inspect)}</code>" 
  • trunk/actionpack/test/active_record_unit.rb

    r4807 r4885  
    1818  begin 
    1919    PATH_TO_AR = "#{File.dirname(__FILE__)}/../../activerecord/lib" 
    20     raise "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR) 
     20    raise LoadError, "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR) 
    2121    $LOAD_PATH.unshift PATH_TO_AR 
    2222    require 'active_record' 
    2323    require 'active_record/fixtures' 
    2424    $stderr.puts 'success' 
    25   rescue Object => e 
     25  rescue LoadError => e 
    2626    $stderr.print "failed. Skipping Active Record assertion tests: #{e}" 
    2727    ActiveRecordTestConnector.able_to_connect = false 
     
    4242        self.connected = true 
    4343      end 
    44     rescue Object => e 
     44    rescue Exception => e  # errors from ActiveRecord setup 
    4545      $stderr.puts "\nSkipping ActiveRecord assertion tests: #{e}" 
    4646      #$stderr.puts "  #{e.backtrace.join("\n  ")}\n" 
     
    5757          ActiveRecord::Base.configurations = { 'sqlite3_ar_integration' => connection_options }  
    5858          ActiveRecord::Base.connection 
    59         rescue Object 
     59        rescue Exception  # errors from establishing a connection 
    6060          $stderr.puts 'SQLite 3 unavailable; falling to SQLite 2.' 
    6161          connection_options = {:adapter => 'sqlite', :dbfile => ':memory:'} 
  • trunk/actionwebservice/CHANGELOG

    r4810 r4885  
    11*SVN* 
     2 
     3* Tighten rescue clauses.  #5985 [james@grayproductions.net] 
    24 
    35* Fixed XMLRPC multicall when one of the called methods returns a struct object. [Kent Sibilev]  
  • trunk/actionwebservice/test/abstract_unit.rb

    r4761 r4885  
    1717  require "#{PATH_TO_AR}/lib/active_record" unless Object.const_defined?(:ActiveRecord) 
    1818  require "#{PATH_TO_AR}/lib/active_record/fixtures" unless Object.const_defined?(:Fixtures) 
    19 rescue Object => e 
     19rescue LoadError => e 
    2020  fail "\nFailed to load activerecord: #{e}" 
    2121end 
  • trunk/activerecord/CHANGELOG

    r4862 r4885  
    11*SVN* 
     2 
     3* Tighten rescue clauses.  #5985 [james@grayproductions.net] 
    24 
    35* Fix spurious newlines and spaces in AR::Base#to_xml output [Jamis Buck] 
  • trunk/activesupport/CHANGELOG

    r4868 r4885  
    11*SVN* 
     2 
     3* Tighten rescue clauses.  #5985 [james@grayproductions.net] 
    24 
    35* Inflections: don't singularize -ies plurals.  [foamdino@gmail.com, Mark Van Holstyn] 
  • trunk/activesupport/lib/active_support/dependencies.rb

    r4837 r4885  
    342342  def load(file, *extras) 
    343343    super(file, *extras) 
    344   rescue Object => exception 
     344  rescue Exception => exception  # errors from loading file 
    345345    exception.blame_file! file 
    346346    raise 
     
    349349  def require(file, *extras) 
    350350    super(file, *extras) 
    351   rescue Object => exception 
     351  rescue Exception => exception  # errors from required file 
    352352    exception.blame_file! file 
    353353    raise 
  • trunk/activesupport/test/core_ext/exception_test.rb

    r4595 r4885  
    55  def get_exception(cls = RuntimeError, msg = nil, trace = nil) 
    66    begin raise cls, msg, (trace || caller) 
    7     rescue Object => e 
     7    rescue Exception => e  # passed Exception 
    88      return e 
    99    end 
  • trunk/railties/CHANGELOG

    r4843 r4885  
    11*SVN* 
     2 
     3* Tighten rescue clauses.  #5985 [james@grayproductions.net] 
    24 
    35* Cleaning up tests. [Kevin Clark, Jeremy Kemper] 
  • trunk/railties/lib/dispatcher.rb

    r4760 r4885  
    4141        controller.process(request, response).out(output) 
    4242      end 
    43     rescue Object => exception 
     43    rescue Exception => exception  # errors from CGI dispatch 
    4444      failsafe_response(output, '500 Internal Server Error', exception) do 
    4545        controller ||= const_defined?(:ApplicationController) ? ApplicationController : ActionController::Base 
     
    130130      def failsafe_response(output, status, exception = nil) 
    131131        yield 
    132       rescue Object 
     132      rescue Exception  # errors from executed block 
    133133        begin 
    134134          output.write "Status: #{status}\r\n" 
     
    153153            end 
    154154          end 
    155         rescue Object 
     155        rescue Exception  # Logger or IO errors 
    156156        end 
    157157      end 
  • trunk/railties/lib/fcgi_handler.rb

    r3618 r4885  
    7777    dispatcher_log :info, "terminated by explicit exit" 
    7878 
    79   rescue Object => fcgi_error 
     79  rescue Exception => fcgi_error  # FCGI errors 
    8080    # retry on errors that would otherwise have terminated the FCGI process, 
    8181    # but only if they occur more than 10 seconds apart. 
     
    9898      time_str = Time.now.strftime("%d/%b/%Y:%H:%M:%S") 
    9999      logger.send(level, "[#{time_str} :: #{$$}] #{msg}") 
    100     rescue Object => log_error 
     100    rescue Exception => log_error  # Logger errors 
    101101      STDERR << "Couldn't write to #{@log_file_path.inspect}: #{msg}\n" 
    102102      STDERR << "  #{log_error.class}: #{log_error.message}\n" 
     
    149149    def process_request(cgi) 
    150150      Dispatcher.dispatch(cgi) 
    151     rescue Object => e 
     151    rescue Exception => e  # errors from CGI dispatch 
    152152      raise if SignalException === e 
    153153      dispatcher_error(e)