[Nitro] transaction exception logging

George Moschovitis george.moschovitis at gmail.com
Sat Jan 7 05:57:29 EST 2006


Ok

On 1/6/06, Tim Larson <tim at keow.org> wrote:
> On Mon, Dec 26, 2005 at 12:31:55PM +0200, George Moschovitis wrote:
> > Ok, will consider this, any other opinions?
> >
> > -g.
>
> Thanks for the patch:
>   Fri Dec 30 13:53:26 EET 2005  George Moschovitis <gm at navel.gr>
>     * Better handling of errors on transactions. [timlarson]
>
> Would you consider adding "raise ex" after the rollback,
> for the reason mentioned below (for handling exceptions)?
> The application may (and mine does) want to have its own
> exception handling outside of the transaction, and this
> is currently blocked because the transaction swallows the
> exception, making it look like it never happened and
> losing any information contained in the exception.
>
> --Tim Larson
>
> >
> > On 12/23/05, Tim Larson <tim at keow.org> wrote:
> > > 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
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>


--
http://www.gmosx.com
http://www.navel.gr
http://www.nitrohq.com




More information about the Nitro-general mailing list