toucan_data_sdk/utils/decorators.py
def catch(logger):
    """
    Decorator to catch an exception and don't raise it.
    Logs information if a decorator failed.

    Note:
        We don't want possible exceptions during logging to be raised.
        This is used to decorate any function that gets executed
        before or after the execution of the decorated function.
    """
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception:
                logger.warning(f"Exception raised in decorator: {func.__name__}")

        return wrapper
    return decorator
def catch(logger):
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception:
                logger.warning(f"Exception raised in decorator: {func.__name__}")

        return wrapper
    return decorator
def catch ( logger ) : def decorator ( func ) : @ wraps ( func ) def wrapper ( * args , * * kwargs ) : try : return func ( * args , * * kwargs ) except Exception : logger . warning ( f"Exception raised in decorator: {func.__name__}" ) return wrapper return decorator
Decorator to catch an exception and don't raise it.
    Logs information if a decorator failed.

    Note:
        We don't want possible exceptions during logging to be raised.
        This is used to decorate any function that gets executed
        before or after the execution of the decorated function.
Decorator to catch an exception and don t raise it . Logs information if a decorator failed .