[Zodb-checkins] CVS: StandaloneZODB/ZEO - zrpc.py:1.18.2.4

Jeremy Hylton jeremy@zope.com
Wed, 3 Oct 2001 08:58:07 -0400


Update of /cvs-repository/StandaloneZODB/ZEO
In directory cvs.zope.org:/tmp/cvs-serv4351

Modified Files:
      Tag: zeo-1_0-branch
	zrpc.py 
Log Message:
Add some explanatory comments to the exception propagation code.

When an error occurs on the server, it sends an error response to the
client.  It's the client's responsibility to raise the exception
contained in the error response to signal the error to the
application.  The traceback for this exception ends at the client's
__call__() method, but the real error occurred somewhere in the server
code.  As a result, people are often confused by the tracebacks they
see and don't know to look in the server's error log for the
server-side traceback.

Add a comment to this effect in the code and add a brief comment on
the very line that raises the exception.  The latter is useful because
it will appear in the traceback the user will see.


=== StandaloneZODB/ZEO/zrpc.py 1.18.2.3 => 1.18.2.4 ===
                     if r=='RN.': return None # Common case!
                     return loads(r[1:])
+                
+                # If c == 'E', an error occured on the server.  In
+                # this case, the return value is a pickled exception.
+                # Unpickle it and raise it on the client side.  The
+                # traceback for this exception ends at this method,
+                # but the real error occurred somewhere in the server
+                # code.  To diagnose the error, look for the real
+                # traceback in the server's zLOG output.
                 if c=='E':
                     try: r=loads(r[1:])
                     except:
                         raise UnUnPickleableError(r[1:])
-                    if type(r) is TupleType: raise r[0], r[1]
-                    raise r
+                    if type(r) is TupleType:
+                        raise r[0], r[1] # see server log for real traceback
+                    raise r 
                 oob=self._outOfBand
                 if oob is not None:
                     r=r[1:]