code: def _exception_gather_guard(self, fn):
          
  
          @functools.wraps(fn)
          def wrapper(*args, **kwargs):
              try:
                  return fn(*args, **kwargs)
              except UserException as e:
                  self.exceptions.append(e)
  
          return wrapper
docs: A higher order function to trap UserExceptions and then log them.
  
          This is to present nicer output to the user when failures are
          occuring in another thread of execution that may not end up at
          the catch-all try/except in main().