#NEWLINE# def on_error( self , exception ) : #NEWLINE# #INDENT# 'Common functions when a socket error occurs. Make sure to set closed\n        and add the exception, and note an exception event.\n\n        :param socket.error exception: The socket error\n\n        ' #NEWLINE# args = [ self . _args [ 'host' ] , self . _args [ 'port' ] , str ( exception ) ] #NEWLINE# if self . _channels [ 0 ] [ 0 ] . open : #NEWLINE# #INDENT# self . _exceptions . put ( exceptions . ConnectionResetException ( * args ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _exceptions . put ( exceptions . ConnectionException ( * args ) ) #NEWLINE# #UNINDENT# self . _events . set ( events . EXCEPTION_RAISED )