28 lines
577 B
Python
28 lines
577 B
Python
from typing import Any, Dict, List, Optional
|
|
from functools import wraps
|
|
|
|
# from pymongo.errors import (
|
|
# ConnectionFailure,
|
|
# OperationFailure,
|
|
# ServerSelectionTimeoutError,
|
|
# PyMongoError,
|
|
# )
|
|
|
|
|
|
def mongo_error_wrapper(func):
|
|
"""Decorator to handle MongoDB operation errors.
|
|
|
|
Catches MongoDB-specific errors and converts them to HTTPExceptionApi.
|
|
"""
|
|
|
|
@wraps(func)
|
|
def wrapper(*args, **kwargs):
|
|
"""
|
|
:param args:
|
|
:param kwargs:
|
|
:return:
|
|
"""
|
|
return func(*args, **kwargs)
|
|
|
|
return wrapper
|