WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix the ProtocolError seen when the server throws an exc

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix the ProtocolError seen when the server throws an exception and running
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Mar 2006 12:42:07 +0000
Delivery-date: Thu, 30 Mar 2006 12:43:57 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID d5f8280c1fa9fb207ce9ea815285a3957eae839f
# Parent  9239f190736d85933bbe64eca0613c24c07617df
Fix the ProtocolError seen when the server throws an exception and running
under Python 2.3; traceback.format_exc was introduced in 2.4, so we can't use
it.

Added some exception logging.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 9239f190736d -r d5f8280c1fa9 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Wed Mar 29 23:11:53 2006
+++ b/tools/python/xen/util/xmlrpclib2.py       Thu Mar 30 10:51:44 2006
@@ -23,8 +23,12 @@
 from httplib import HTTPConnection, HTTP
 from xmlrpclib import Transport
 from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
-import xmlrpclib, socket, os, traceback
+import xmlrpclib, socket, os
 import SocketServer
+
+import xen.xend.XendClient
+from xen.xend.XendLogging import log
+
 
 # A new ServerProxy that also supports httpu urls.  An http URL comes in the
 # form:
@@ -60,8 +64,7 @@
                                        verbose, allow_none)
 
 # This is a base XML-RPC server for TCP.  It sets allow_reuse_address to
-# true, and has an improved marshaller that serializes unknown exceptions
-# with full traceback information.
+# true, and has an improved marshaller that logs and serializes exceptions.
 
 class TCPXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer):
     allow_reuse_address = True
@@ -80,10 +83,10 @@
                                        allow_none=1)
         except xmlrpclib.Fault, fault:
             response = xmlrpclib.dumps(fault)
-        except:
+        except Exception, exn:
+            log.exception(exn)
             response = xmlrpclib.dumps(
-                xmlrpclib.Fault(1, traceback.format_exc())
-                )
+                xmlrpclib.Fault(xen.xend.XendClient.ERROR_INTERNAL, str(exn)))
 
         return response
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix the ProtocolError seen when the server throws an exception and running, Xen patchbot -unstable <=