[Zope-dev] Pointless exception re-raising in DA.py
Clemens Robbenhaar
robbenhaar at espresto.com
Wed Mar 24 10:24:17 EST 2004
Hi Chris,
> In Shared/DC/ZRDB/DA.py, Line 399 of Zope 2.6.1 and line 419 in 2.7.0, there's
> this rather pointless lump of code:
>
> try: DB__=dbc()
> except: raise DatabaseError, (
> '%s is not connected to a database' % self.id)
>
> ...which only serves to mask the real cause of the problem when trying to obtain
> a connection.
I remeber I made a collector issue about that liens of code:
http://www.zope.org/Collectors/Zope/927
Previously this has been a string valued exception. Actually I like it
to be an exception of a certain type now, because I can now selectively
catching this DatabaseError and distinguish it from other errors. No
need for a evil bare except.
The reason is that I would like to treat errors when accessing
an external data base different from other errors; often the data
obtained there is only "optional" to the page, so I don't want to show
usered the error page in this case, only to fill up doem slot with
"sorry, that certain piece of information is not availabe, because our
sql data base sucks".
I see Your point. However is there any chance that "dbc()" does raise
something more specific? I am afraid it does not.
If it does not, I would have to go back to an evil bare except ...
Cheers,
Clemens
More information about the Zope-Dev
mailing list