示例#1
0
 def wrapper(*args, **kwArgs):
     try:
         return func(*args, **kwArgs)
     except:
         LOG_WRAPPED_CURRENT_EXCEPTION(wrapper.__name__, func.__name__,
                                       func.func_code.co_filename,
                                       func.func_code.co_firstlineno + 1)
示例#2
0
 def wrapper(*args, **kwArgs):
     try:
         return func(*args, **kwArgs)
     except:
         LOG_WRAPPED_CURRENT_EXCEPTION(wrapper.__name__, func.__name__,
                                       func.func_code.co_filename,
                                       func.func_code.co_firstlineno + 1)
         CRITICAL_ERROR('Exception in no-fail code')
        def noexceptWrapper(*args, **kwArgs):
            try:
                return func(*args, **kwArgs)
            except:
                _logErrorMessageFromArgs('Exception in noexcept', args)
                LOG_WRAPPED_CURRENT_EXCEPTION(noexceptWrapper.__name__, func.__name__, func.func_code.co_filename, func.func_code.co_firstlineno + 1)

            return returnOnExcept
 def doCall(func, processor):
     try:
         return processor()
     except AdispException as e:
         raise e
     except Exception as e:
         funcName = func.__name__
         LOG_WRAPPED_CURRENT_EXCEPTION('adisp', funcName, func.func_code.co_filename, func.func_code.co_firstlineno + 1)
         raise AdispException('There was an error during %s async call.' % funcName, e)
示例#5
0
 def wrapper(*args, **kwArgs):
     try:
         lastTick = time.time()
         result = func(*args, **kwArgs)
         timeSinceLastTick = time.time() - lastTick
         if timeSinceLastTick > time_tracking.DEFAULT_TIME_LIMIT:
             LOG_TIME_WARNING(timeSinceLastTick, context=(getattr(args[0], 'id', 0),
              func.__name__,
              args,
              kwArgs))
         return result
     except:
         LOG_WRAPPED_CURRENT_EXCEPTION(wrapper.__name__, func.__name__, func.func_code.co_filename, func.func_code.co_firstlineno + 1)
示例#6
0
 def wrapper(*args, **kwArgs):
     try:
         lastTick = time.time()
         result = func(*args, **kwArgs)
         timeSinceLastTick = time.time() - lastTick
         if timeSinceLastTick > 0.02:
             LOG_WARNING('Took %.2f sec!' % timeSinceLastTick, args[0].id,
                         func.__name__, args, kwArgs)
         return result
     except:
         LOG_WRAPPED_CURRENT_EXCEPTION(wrapper.__name__, func.__name__,
                                       func.func_code.co_filename,
                                       func.func_code.co_firstlineno + 1)
 def exposedtoclientWrapper(*args, **kwArgs):
     try:
         lastTick = time.time()
         result = func(*args, **kwArgs)
         timeSinceLastTick = time.time() - lastTick
         if timeSinceLastTick > time_tracking.DEFAULT_TIME_LIMIT:
             LOG_TIME_WARNING(timeSinceLastTick, context=(getattr(args[0], 'id', 0),
              func.__name__,
              args,
              kwArgs))
             if not IS_CLIENT and not IS_BOT:
                 incrTickOverspends()
         return result
     except:
         _logErrorMessageFromArgs('Exception in exposedtoclient', args)
         LOG_WRAPPED_CURRENT_EXCEPTION(exposedtoclientWrapper.__name__, func.__name__, func.func_code.co_filename, func.func_code.co_firstlineno + 1)