#NEWLINE# def send_error( description = None , exception = None ) : #NEWLINE# #INDENT# G . ERROR_COUNT += 1 #NEWLINE# data = { #NEWLINE# #INDENT# 'jsondump' : { #NEWLINE# #INDENT# 'error_count' : G . ERROR_COUNT , #NEWLINE# #UNINDENT# } , #NEWLINE# 'message' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'dir' : G . COLAB_DIR , #NEWLINE# #UNINDENT# } #NEWLINE# stack = '' #NEWLINE# if G . AGENT : #NEWLINE# #INDENT# data [ 'owner' ] = getattr ( G . AGENT , 'owner' , None ) #NEWLINE# data [ 'username' ] = getattr ( G . AGENT , 'username' , None ) #NEWLINE# data [ 'workspace' ] = getattr ( G . AGENT , 'workspace' , None ) #NEWLINE# #UNINDENT# if exception : #NEWLINE# #INDENT# exc_info = sys . exc_info ( ) #NEWLINE# try : #NEWLINE# #INDENT# stack = traceback . format_exception ( * exc_info ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# if ( exc_info [ 0 ] is None ) : #NEWLINE# #INDENT# stack = 'No sys.exc_info()' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stack = 'Python is rtardd' #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# description = str ( exception ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# description = 'Python is rtadd' #NEWLINE# #UNINDENT# data [ 'message' ] = { #NEWLINE# #INDENT# 'description' : description , #NEWLINE# 'stack' : stack , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# msg . log ( 'Floobits plugin error! Sending exception report: ' , data [ 'message' ] ) #NEWLINE# if description : #NEWLINE# #INDENT# data [ 'message' ] [ 'description' ] = description #NEWLINE# #UNINDENT# if ( G . ERRORS_SENT >= G . MAX_ERROR_REPORTS ) : #NEWLINE# #INDENT# msg . warn ( 'Already sent ' , G . ERRORS_SENT , ' errors this session. Not sending any more.\n' , description , exception , stack ) #NEWLINE# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# api_url = ( 'https://%s/api/log' % G . DEFAULT_HOST ) #NEWLINE# r = api_request ( G . DEFAULT_HOST , api_url , data ) #NEWLINE# G . ERRORS_SENT += 1 #NEWLINE# return r #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# print ( description )