title: Exception is not getting catch in rescue block (retry)
body: <p>The exception <code>ActiveRecord::StaleObjectError.new</code> is not being caught in my rescue block (retry). Why I am not able to catch Exception? </p>
  
  <pre><code>  attr_accessible :original_updated_at
  
    def original_updated_at
      @original_updated_at || updated_at.to_f
    end
  
    def set_total_and_buckets_used
      tries = 0
      begin
        if total_approved - attributes["total_amount_used"] &lt; 0
            raise Exception.new("Total amount used is greater than approved")
        elsif self.updated_at.to_f == original_updated_at
          @original_updated_at = nil
          raise ActiveRecord::StaleObjectError.new("Car is changed while you were editing")
        else
          self.with_lock do
            attributes["updated_at"] = Time.now.utc
            Product.where(:id =&gt; self.id).update_all(attributes)
            self.attributes = attributes
          end
        end
      rescue ActiveRecord::StaleObjectError =&gt; e
        if tries &lt; 3
          tries += 1
          retry
        else
          raise Exception.new(timeout.inspect)
        end
      end
      self.reload
      attributes
    end
  </code></pre>