20 lines
478 B
Python
20 lines
478 B
Python
from backend import LrcException
|
|
import logging
|
|
|
|
logger = logging.getLogger("lrc.tools.exception_decorator")
|
|
|
|
|
|
def exception_decorator(*exceptions):
|
|
def decorator(func):
|
|
def new_func(*args, **kwargs):
|
|
try:
|
|
ret = func(*args, **kwargs)
|
|
return ret
|
|
except exceptions as e:
|
|
logger.error(str(e))
|
|
raise LrcException(e)
|
|
|
|
return new_func
|
|
|
|
return decorator
|