This repository has been archived on 2022-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
lets/helpers/exceptionsTracker.py
2018-12-09 00:15:56 -05:00

18 lines
500 B
Python

import sys
import traceback
from functools import wraps
from common.log import logUtils as log
def trackExceptions(moduleName=""):
def _trackExceptions(func):
def _decorator(request, *args, **kwargs):
try:
response = func(request, *args, **kwargs)
return response
except:
log.error("Unknown error{}!\n```\n{}\n{}```".format(" in "+moduleName if moduleName != "" else "", sys.exc_info(), traceback.format_exc()), True)
return wraps(func)(_decorator)
return _trackExceptions