def omit_exception(method=None, return_value=None):

    if method is None:
        return functools.partial(omit_exception, return_value=return_value)

    @functools.wraps(method)
    def _decorator(self, *args, **kwargs):
        try:
            return method(self, *args, **kwargs)
        except ConnectionInterrupted as e:
            if self._ignore_exceptions:
                if DJANGO_REDIS_LOG_IGNORED_EXCEPTIONS:
                    logger.error(str(e))

                return return_value
            raise e.parent
    return _decorator
Simple decorator that intercepts connection
dataset/ETHPy150Open niwinz/django-redis/django_redis/cache.py/omit_exception