code: def add_exception(self, exception, stack, remote=False):
          
          self._check_ended()
          self.add_fault_flag()
  
          if hasattr(exception, '_recorded'):
              setattr(self, 'cause', getattr(exception, '_cause_id'))
              return
  
          exceptions = []
          exceptions.append(Throwable(exception, stack, remote))
  
          self.cause['exceptions'] = exceptions
          self.cause['working_directory'] = os.getcwd()
docs: Add an exception to trace entities.
  
          :param Exception exception: the catched exception.
          :param list stack: the output from python built-in
              `traceback.extract_stack()`.
          :param bool remote: If False it means it's a client error
              instead of a downstream service.