def _exception_gather_guard(self, fn):

        @functools.wraps(fn)
        def wrapper(*args, **kwargs):
            try:
                return fn(*args, **kwargs)
            except UserException, e:
                self.exceptions.append(e)

        return wrapper
A higher order function to trap UserExceptions and then log them.
dataset/ETHPy150Open wal-e/wal-e/wal_e/operator/backup.py/Backup._exception_gather_guard