commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5462 - trunk/gnue-common/src/rpc


From: reinhard
Subject: r5462 - trunk/gnue-common/src/rpc
Date: Mon, 22 Mar 2004 12:28:06 -0600 (CST)

Author: reinhard
Date: 2004-03-22 12:28:05 -0600 (Mon, 22 Mar 2004)
New Revision: 5462

Modified:
   trunk/gnue-common/src/rpc/client.py
   trunk/gnue-common/src/rpc/server.py
Log:
Added test code for exception handling.


Modified: trunk/gnue-common/src/rpc/client.py
===================================================================
--- trunk/gnue-common/src/rpc/client.py 2004-03-22 16:51:10 UTC (rev 5461)
+++ trunk/gnue-common/src/rpc/client.py 2004-03-22 18:28:05 UTC (rev 5462)
@@ -187,6 +187,8 @@
 
 if __name__ == '__main__':
 
+  import traceback
+
   connection = attach ('py_xmlrpc', {})
 
   obj = connection.request ('test')
@@ -203,6 +205,12 @@
 # subobj.test ()
   del subobj
 
+  print 'testing exception ...'
+  try:
+    obj.exceptiontest ()
+  except:
+    traceback.print_exc ()
+
   print 'shutting donwn server ...'
   try:
     # This will raise an exception because the server will not even answer any

Modified: trunk/gnue-common/src/rpc/server.py
===================================================================
--- trunk/gnue-common/src/rpc/server.py 2004-03-22 16:51:10 UTC (rev 5461)
+++ trunk/gnue-common/src/rpc/server.py 2004-03-22 18:28:05 UTC (rev 5462)
@@ -236,6 +236,9 @@
   import StringIO
   import mx.DateTime
 
+  class TestError (Exception):
+    pass
+
   class subobject:
     def __init__ (self):
       print "Initializing subobject"
@@ -269,6 +272,9 @@
     def objtest (self):
       return subobject ()
 
+    def exceptiontest (self):
+      raise TestError, 'Message string'
+
     def shutdown (self):
       sys.exit (0)
 
@@ -281,6 +287,7 @@
                                   '<method name="datetimetest"/>'
                                   '<method name="booltest"/>'
                                   '<method name="objtest"/>'
+                                  '<method name="exceptiontest"/>'
                                   '<method name="shutdown"/>'
                                 '</service>'
 #                               '<service name="subobject" 
binding="subobject">'





reply via email to

[Prev in Thread] Current Thread [Next in Thread]