[ZODB-Dev] George Bailey'd objects cause failure in FileStorage._loadBack

Barry A. Warsaw barry@zope.com
Fri, 1 Nov 2002 11:45:15 -0500


>>>>> "TD" == Toby Dickenson <tdickenson@geminidataloggers.com> writes:

    >> In the Berkeley storages, I simply let KeyErrors that the
    >> underlying library might raise percolate up.  And in loading a
    >> GBO, I simply raise a KeyError.

    >> I think in general, raising any error derived from KeyError is
    >> probably fine,

    TD> Yes. I think the only purpose of POSKeyError is simply to
    TD> provide a __str__ so that tracebacks contain readable strings,
    TD> rather than 8 bytes of binary mash.

Ah ok.  I'm using %r in my KeyError string so that should be a little
better.

    >> but I think applications should be prepared to catch just
    >> KeyError for maximum portability between storages.

    TD> In principal, yes.

    TD> In practice I dont think the question will arise. When would
    TD> an application ever catch this exception specifically? 
    TD> Triggering the exception is almost certainly a hard error
    TD> which an application can not recover from.

There may not be many "clients" of the storages to make it an
important thing to worry about.  I'm more concerned with specifying
the storage API strongly enough, and I think when and what kind of
exceptions can get raised is an important part of that.

-Barry