[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5639 - trunk/gnue-common/src/rpc
From: |
reinhard |
Subject: |
r5639 - trunk/gnue-common/src/rpc |
Date: |
Mon, 5 Apr 2004 08:03:10 -0500 (CDT) |
Author: reinhard
Date: 2004-04-05 08:03:09 -0500 (Mon, 05 Apr 2004)
New Revision: 5639
Modified:
trunk/gnue-common/src/rpc/client.py
Log:
Much imporved DistantError handling.
Modified: trunk/gnue-common/src/rpc/client.py
===================================================================
--- trunk/gnue-common/src/rpc/client.py 2004-04-05 12:32:42 UTC (rev 5638)
+++ trunk/gnue-common/src/rpc/client.py 2004-04-05 13:03:09 UTC (rev 5639)
@@ -95,13 +95,25 @@
pass
# -----------------------------------------------------------------------------
-# An error which has occured on the server and which is
-# raised again on the server
+# An error which has occured on the server and is raised again on the client
# -----------------------------------------------------------------------------
class DistantError (Error):
- pass
+ """
+ Indicates an exception that happened on the server side.
+ If e is an exception of this type, then e.message is the message text of the
+ exception that occured on the server side, e.type is a string containing the
+ name of the type of the server side exception, and e.detail is the complete
+ server side traceback.
+ """
+ def __init__ (self, traceback):
+ self.detail = traceback
+ list = string.split (traceback, '\n')
+ info = string.split (list [-2], ': ')
+ self.type = info [0]
+ Error.__init__ (self, info [1])
+
# =============================================================================
# Self test code - requires server.py running
# =============================================================================
@@ -109,6 +121,7 @@
if __name__ == '__main__':
import traceback
+ from gnue.common.rpc import client # to recogize DistantError
connection = attach ('xmlrpc', {})
@@ -129,8 +142,17 @@
print 'testing exception ...'
try:
obj.exceptiontest ()
- except:
+ except client.DistantError, e:
+ print "-" * 70
+ print "exception message:", e
+ print "-" * 70
+ print "local traceback:"
traceback.print_exc ()
+ print "-" * 70
+ print "remote exception type:", e.type
+ print "-" * 70
+ print "remote exception detail:", e.detail
+ print "-" * 70
print 'shutting donwn server ...'
try:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5639 - trunk/gnue-common/src/rpc,
reinhard <=