summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2003-03-22 19:15:58 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2003-03-22 19:15:58 (GMT)
commite51529d79a5b575e648bf5e6eef5324c8fb819ba (patch)
tree70a8ac25d86d085953ee015d21040721571bfe69 /Lib
parentdf5126df56cff1aae3a2a9bf61352efff40c915c (diff)
downloadcpython-e51529d79a5b575e648bf5e6eef5324c8fb819ba.zip
cpython-e51529d79a5b575e648bf5e6eef5324c8fb819ba.tar.gz
cpython-e51529d79a5b575e648bf5e6eef5324c8fb819ba.tar.bz2
Improve error message handling.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/rpc.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py
index 615c1f4..8bbc214 100644
--- a/Lib/idlelib/rpc.py
+++ b/Lib/idlelib/rpc.py
@@ -87,13 +87,31 @@ class RPCServer(SocketServer.TCPServer):
return self.socket, self.server_address
def handle_error(self, request, client_address):
- """Override TCPServer method, no error message if exiting"""
+ """Override TCPServer method
+
+ Error message goes to __stderr__. No error message if exiting
+ normally or socket raised EOF. Other exceptions not handled in
+ server code will cause os._exit.
+
+ """
try:
raise
except SystemExit:
raise
- else:
- TCPServer.handle_error(request, client_address)
+ except EOFError:
+ pass
+ except:
+ erf = 'sys.__stderr__'
+ print>>erf, '-'*40
+ print>>erf, 'Unhandled server exception!'
+ print>>erf, 'Thread: %s' % threading.currentThread().getName()
+ print>>erf, 'Client Address: ', address
+ print>>erf, 'Request: ', repr(request)
+ traceback.print_exc(file=erf)
+ print>>erf, '\n*** Unrecoverable, server exiting!'
+ print>>erf, '-'*40
+ import os
+ os._exit
objecttable = {}