[Python-Dev] Re: PEP 282 comments

Jeremy Hylton jeremy@zope.com
Wed, 20 Mar 2002 18:08:27 -0500


On Wed, 20 Mar 2002 22:57:44 -0000
 "Vinay Sajip" <vinay_sajip@red-dove.com> wrote:
> I have to declare a preference for Mark's and Guido's
> approach. The reason
> is - what is a "normal" exception? And if it is "normal",
> why do we need to
> see a stack trace for it?

ZEO is a component that lets clients on remote machines
access a ZODB storage using a custon Python RMI.  (The
details aren't exactly important, except that it's a
concrete example.)  IOW, ZEO + ZODB is a client-server
object database.

It's possible for all sorts of things to go wrong for an
individual RMI.  There can be a problem marshalling or
unmarshalling the objects.  There can be a problem with
executing the actual methods on the server.  There can be a
problem with application code that is executed as a result
of calling some method on the server.  Etc.

Few of these errors are fatal.  Some of them may be
uninteresting most of the time.  So I'd like to log
tracebacks and vary the log level depending on the
importance of the event that caused the exception.

One particular example is a KeyError.  The server will raise
a KeyError if the client asks for an object that doesn't
exist.  There are clients that catch this error on the
client side and handle it cleanly.  It's not an important
exception for them.  But I'd like to log the traceback on
the server to handle cases where the client isn't expecting
it.  I'd probably log this at debug() level.  Most of the
time, nobody cares about a KeyError.  But it might
occasionally be useful when debugging something.

Jeremy