Chris Withers writes:
 > Clemens Robbenhaar wrote:
 > >  Ok, if this is the proper dance to catch such exceptions with Zope
 > > without risking ZODB corruption I will go with it. So far I have not
 > > been sure, that ConflictError is the only type needing special
 > > treatement in these cases.
 > Well, the PROPER dance would be to only catch exceptions that you're happy to 
 > ignroe from your database. You should be able to find those otu fairly quickly. 
 > Any new ones htat come along later probably want to be looked at by you before 
 > being automatically ignored...

 Hm, figuring out the "right" exception actually the problem; if the
data base connector would raise an exception of a certain type due to
unability to connect I could catch these and let the others pass.

 Unfortunately I am not able to figure out the interesting ones so
quickly by experimenting, because I cannot think about (or even
reproduce) everything that may actually fail.

 However, looking at the code this thread started with: Catching all
exceptions in a certain (relaively high level) place and transforming
them into something else does not really help a lot there; this may
catch real programming errors as well.  So I finally got the point why
the try: except: block there should go away. I guess the specific data
base connector should raise that "DB-failed" specific exception, instead,

 Unfortunately there is no sich general exception for it. (such as java
has as java.sql.SQLException ... often not very informative, but at least one
knows its from the data base.)
  Currently I am bound to hard wire the exception type the specific
data base connection raises in my code and have to change the code if I
would change the underlying data base.

 Maybe the "DatabaseError" class could remain in the, so specific
data base connections could reuse this exception type?
 Or it is much to late to introduce such an exception type, as none of
the supporterd of a data base connection product will rewrite their
product to use this exception now? (btw: does somebody know, if Zope3
would maybe have such an "external data source connection" specific exception?)

Cheers anyway,


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to