#NEWLINE# def _run_callback( self , callback , * args ) : #NEWLINE# #INDENT# def wrapper( ) : #NEWLINE# #INDENT# self . _pending_callbacks -= 1 #NEWLINE# try : #NEWLINE# #INDENT# callback ( * args ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# app_log . error ( 'Uncaught exception, closing connection.' , exc_info = True ) #NEWLINE# self . close ( exc_info = True ) #NEWLINE# raise #NEWLINE# #UNINDENT# self . _maybe_add_error_listener ( ) #NEWLINE# #UNINDENT# with stack_context . NullContext ( ) : #NEWLINE# #INDENT# self . _pending_callbacks += 1 #NEWLINE# self . io_loop . add_callback ( wrapper )