[Erp5-dev] exception handling in activities

Jean-Paul Smets jp at nexedi.com
Tue Mar 13 09:11:33 CET 2007


BTW, self.log is deprecated.

Either use LOG or Log.log

JPS.

Le lundi 12 mars 2007 18:07, bartek a écrit :
> Hello
>
> I observed a behaviour that I did not expect: a method called from
> unittest via portal_activities should raise an exception, but it doesn't
> - but activities say they can not execute it, and the test fails with
> "tic is looping forever" message. The big question is, what happens to
> the exception, and how do the activities know the method failed???
>
> Specifically, the method went like
>
> ...
> self.log('before edit')
> self.edit(**kw)
> self.log('after edit')
> ...
>
> Logs said "before edit", and nothing more. Doing like:
>
> try:
>    ...
>    self.log('before edit')
>    self.edit(**kw)
>    self.log('after edit')
>    ...
> except Exception, e:
>    self.log(e)
>    raise e
>
> didn't help - still nothing in the logs, but activities failed. I had to
> use a crystal ball to figure out what was wrong - turned out that kw
> contained an illegal argument. But if so, then an exception should have
> been raised - so what happened to it? Was it caught somewhere else?
> Needless to say, it is debugging nightmare...
>
> Bartek
>
>
> _______________________________________________
> Erp5-dev mailing list
> Erp5-dev at erp5.org
> http://erp5.org/mailman/listinfo/erp5-dev

-- 
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com



More information about the Erp5-dev mailing list