[Zope-DB] catching sql method exceptions inside python scripts

Dieter Maurer dieter at handshake.de
Mon Apr 5 14:06:51 EDT 2004


Chris Withers wrote at 2004-4-5 11:15 +0100:
>Jim Abramson wrote:
>
>> (2.6.1)
>> Module Shared.DC.ZRDB.DA, line 399, in __call__
>> 
>> 399:        try: DB__=dbc()
>> 400:        except: raise 'Database Error', (
>> 401:            '%s is not connected to a database' % self.id)
>
>*chuckles*
>
>I'm currently campaigning on zope-dev to have that particular turd revoked ;-)
>
>Check the list archives, no one has raised any valid concerns so far,

I proposed an improvement to removing the "try:...except:".

  The improvement would address your concerns (loosing information
  about the actual problem) but still retain a single defined
  exception (which would help users to catch the exception, if relevant).

  I would cost you a few lines of additional code.

  These few lines of code were to complex in your opinion....

-- 
Dieter



More information about the Zope-DB mailing list