[Zope] exceptions/documentation problem
Dieter Maurer
dieter at handshake.de
Tue Jul 20 15:12:35 EDT 2004
Chris Withers wrote at 2004-7-19 07:55 +0100:
>Dieter Maurer wrote:
>> Note that it is *very* dangerous to catch exceptions.
>
>I don't think so...
>
>> When you do, your chance is quite high that you make your persistent
>> state inconsistent -- one of the most horrible things that can happen.
>
>Huh?
>
>try:
> myfolder[somevar]
>except KeyError:
> myfolder.manage_addProduct...
>
>How is that going to result in inconsistent persistent state?
I spoke of "your chance is quite high" and not of "you definitely will get"...
The above code will not cause inconsistencies.
But, whenever code in the "try" block modifies any persistent storage
the chance of inconsistencies is indeed high.
The danger is higher than using ZClasses ;-)
--
Dieter
More information about the Zope
mailing list