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

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 1 Nov 2002 16:28:41 +0000


On Friday 01 November 2002 4:12 pm, Barry A. Warsaw wrote:

> 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,=20

Yes. I think the only purpose of POSKeyError is simply to provide a __str=
__ so=20
that tracebacks contain readable strings, rather than 8 bytes of binary m=
ash.

[ If we were doing this all over again I think a better approach would be=
 to=20
have a seperate type for oids, at it could have a nice __str__. Then we c=
ould=20
just use normal KeyErrors, and the 'print oid' in the test harness at the=
 top=20
of this thread would not produce output that confuses my mailer ]

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

In principal, yes.

In practice I dont think the question will arise. When would an applicati=
on=20
ever catch this exception specifically? Triggering the exception is almos=
t=20
certainly a hard error which an application can not recover from.