#NEWLINE# @ contextmanager #NEWLINE# def io_exception_context( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( yield ) #NEWLINE# #UNINDENT# except ( socket . error , OSError , IOError ) as e : #NEWLINE# #INDENT# raise TTransportException ( type = TTransportException . END_OF_FILE , message = str ( self ) ) #NEWLINE# #UNINDENT# except iostream . StreamBufferFullError as e : #NEWLINE# #INDENT# raise TTransportException ( type = TTransportException . UNKNOWN , message = str ( e ) ) #NEWLINE# #UNINDENT# except gen . TimeoutError as e : #NEWLINE# #INDENT# raise TTransportException ( type = TTransportException . TIMED_OUT , message = str ( e ) )