mirror of
https://github.com/Kludex/awesome-fastapi-projects.git
synced 2025-02-22 00:02:04 +00:00
15 lines
350 B
Python
15 lines
350 B
Python
|
from typing import Any, Callable
|
||
|
|
||
|
from populate.logger import log
|
||
|
|
||
|
|
||
|
def ignore_exceptions(func: Callable):
|
||
|
def wrapper(*args: Any, **kwargs: Any):
|
||
|
try:
|
||
|
return func(*args, **kwargs)
|
||
|
except Exception:
|
||
|
log.exception(f"An exception has occurred on {func.__name__}")
|
||
|
return None
|
||
|
|
||
|
return wrapper
|