from typing import Type
import functools
import logging


def async_ignore_multiple_errors(errors_to_ignore: list[Type[Exception]]):
    """Decorator used to ignore a list of errors for an async function

    Parameters
    ----------
    errors_to_ignore : list[Type[Exception]]
        The list of error types to ignore
    """

    def decorator(func):
        @functools.wraps(func)
        async def wrapper(*args, **kwargs):
            try:
                await func(*args, **kwargs)
            except tuple(errors_to_ignore) as e:
                logging.info(f"Ignored an error: {e}")

        return wrapper

    return decorator