[Idle-dev] CVS: idle rpc.py,1.20,1.21

Kurt B. Kaiser kbk@users.sourceforge.net
Sat, 22 Mar 2003 11:16:02 -0800


Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv20354

Modified Files:
	rpc.py 
Log Message:
Improve error message handling.


Index: rpc.py
===================================================================
RCS file: /cvsroot/idlefork/idle/rpc.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** rpc.py	12 Mar 2003 20:51:59 -0000	1.20
--- rpc.py	22 Mar 2003 19:15:58 -0000	1.21
***************
*** 88,98 ****
  
      def handle_error(self, request, client_address):
!         """Override TCPServer method, no error message if exiting"""
          try:
              raise
          except SystemExit:
              raise
!         else:
!             TCPServer.handle_error(request, client_address)
  
  
--- 88,116 ----
  
      def handle_error(self, request, client_address):
!         """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
!         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