3rd try on server traceback printing

This commit is contained in:
Dan Williams 2006-05-05 15:53:16 -04:00
parent 670a916183
commit 9d98c5e5ae

View File

@ -5,6 +5,9 @@ import threading
import traceback import traceback
import select import select
import time import time
import xmlrpclib
import sys
import gobject import gobject
import SimpleXMLRPCServer import SimpleXMLRPCServer
import SocketServer import SocketServer
@ -60,6 +63,9 @@ class GlibXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
pass pass
except socket.error, e: except socket.error, e:
print "Error (%s): socket error - '%s'" % (self.client_address, e) print "Error (%s): socket error - '%s'" % (self.client_address, e)
except:
print "Error while processing POST:"
traceback.print_exc()
_del_authinfo() _del_authinfo()
class GlibXMLRPCServer(GlibTCPServer, SimpleXMLRPCServer.SimpleXMLRPCDispatcher): class GlibXMLRPCServer(GlibTCPServer, SimpleXMLRPCServer.SimpleXMLRPCDispatcher):
@ -98,18 +104,16 @@ class GlibXMLRPCServer(GlibTCPServer, SimpleXMLRPCServer.SimpleXMLRPCDispatcher)
# wrap response in a singleton tuple # wrap response in a singleton tuple
response = (response,) response = (response,)
response = xmlrpclib.dumps(response, methodresponse=1) response = xmlrpclib.dumps(response, methodresponse=1)
except Fault, fault: except xmlrpclib.Fault, fault:
response = xmlrpclib.dumps(fault) response = xmlrpclib.dumps(fault)
except: except:
set = sys.exc_type print "Exception while processing request:"
sev = sys.exc_value traceback.print_exc()
ser = sys.exc_traceback
# report exception back to server # report exception back to server
response = xmlrpclib.dumps(xmlrpclib.Fault(1, "%s:%s" % (set, sev))) response = xmlrpclib.dumps(
xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value))
print "Exception while processing request:" )
traceback.print_exception(set, sev, ser)
return response return response