[Nitro] transaction exception logging

Tim Larson tim at keow.org
Fri Dec 23 09:53:30 EST 2005


In og/lib/og/store.rb "def transaction", why is there all
that logging code present?  It make it harder to find the
error location than a simple rollback and re-raising of
the exception would.  Also it makes test case output for
expected failures be unnecessarily verbose and redundant,
and the lack of re-raising the exception makes it difficult
to test when and if the right exceptions are being raised
by the code being tested.

I am recommending:

  def transaction(&block)
    begin
      start
      yield(self)
      commit
    rescue => ex
      #Logger.error 'Erro
      #Logger.error ex
      #Logger.error ex.ba
      rollback
      raise ex
    end
  end

--Tim Larson



More information about the Nitro-general mailing list