[ZODB-Dev] Exception when using dead connections

Christian Reis kiko at async.com.br
Thu May 8 14:22:54 EDT 2003


On Thu, May 08, 2003 at 04:55:09PM +0100, Toby Dickenson wrote:
> On Thursday 08 May 2003 4:39 pm, Christian Reis wrote:
> 
> > Even so, db.close() closes the storage and the same error appears. We
> > need a way to guard against committing a transaction on a connection to
> > a closed db *and* storage -- both are interchangeable there.
> 
> yes
> 
> > Is ValueError the correct exception?
> 
> I suggest some new exception class derived from POSException.StorageError. 
> Call it POSException.ClosedError perhaps, to take inspiration from 
> POSException.ReadOnlyError.

Another place for potential problems, Connection.close(), has:

    db=self._db
    
    # [...]
    db._closeConnection(self)

We need at least an if db: guard at the top. Should it raise an
exception or just return?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL



More information about the ZODB-Dev mailing list