[Zope3-dev] Bare excepts in z3c.zalchemy
Philipp von Weitershausen
philipp at weitershausen.de
Fri Mar 2 14:35:14 EST 2007
On 2 Mar 2007, at 12:10 , Jodok Batlogg wrote:
> On Mar 2, 2007, at 5:00 PM, Philipp von Weitershausen wrote:
>
>> For the lack of a better mailinglist, I'm posting this to zope3-dev:
>>
>> z3c.zalchemy is pretty cool, but the tons of bare except clauses
>> make me a bit uneasy. When I see them, I wonder what this code is
>> expecting to fail and why. Plus, there are no comments as to why a
>> try/except was used in the first place.
>
> can you elaborate?
I can't, other than I have no idea *why* these are bare excepts and
not catching a specific exception. Which one I can't tell you, I'm
not the original author and have no idea why catching an exception is
necessary at that point anyway.
All I know is that bare excepts are potentially masking exceptions
that I'd like to know about, especially when they're used like this:
try:
...
except:
pass
With code like this I ask myself: what did the author think/
experience go wrong and why is it ok to just go on without making an
error report??? I would at least expect a unit test that would
exercise the except clause, but I can't find any mentioning of that
either...
> i found six bare excepts. four of them in tearDown of the tests.
> the remaining two in _doCreateTable and dropTable
Right. I'm not sure if it makes a difference where these bare excepts
are. If they're in tests it's just as bad because the tests might be
running fine while there's actually an error going on.
More information about the Zope3-dev
mailing list