[Erp5-dev] exception handling in activities

bartek bartek at erp5.pl
Mon Mar 12 18:07:23 CET 2007


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





More information about the Erp5-dev mailing list