code: def run_trial_exceptions(self, *args, **kwargs):
          '''
          A wrapper for run_trial that catches exceptions and returns them.
          It is meant for async simulations
          '''
          try:
              return self.run_trial(*args, **kwargs)
          except Exception as ex:
              c = ex.__cause__
              c.message = ''.join(traceback.format_exception(type(c), c, c.__traceback__)[:])
              return f run_trial_exceptions(self, *args, **kwargs):
          '''
          A wrapper for run_trial that catches exceptions and returns them.
          It is meant for async simulations
          '''
          try:
              return self.run_trial(*args, **kwargs)
          except Exception as ex:
              c = ex.__cause__
              c.message = ''.join(traceback.format_exception(type(c), c, c.__traceback__)[:])
              return c
docs: A wrapper for run_trial that catches exceptions and returns them.
          It is meant for async simulations