def wrapper(self, tensor_or_op):
    """Wrapper when calling func to re-raise exceptions."""
    try:
      return func(self, tensor_or_op)
    except _UnexpectedPlaceholderError as e:
      context = (f' tf.function name: `{e.func_graph_name}`'
                 if e.func_graph_name else '')
      raise ValueError(
          'The tensor_or_op {} depended on a placeholder ({}) that was not '
          'in the input_signature.  This may have be caused by manually '
          'adding a placeholder to the graph.{}'.format(tensor_or_op, e.tensor,
                                                        context)) from e
    except _UnexpectedTableError as e:
      if e.func_graph_name:
        raise ValueError(
            'The tensor_or_op {} depended on an initializable table ({}) that '
            'is part of a tf.function graph ({}), this is not supported. This'
            ' may be a result of initializing a table in a tf.function'
            ''.format(tensor_or_op, e.op, e.func_graph_name)) from e
      else:
        raise ValueError(
            'The tensor_or_op {} depended on an initializable table ({}) that '
            'was not tracked by the graph analysis.  This may be caused by '
            'adding an initializable table without adding its initializer to '
            'the collection tf.GraphKeys.TABLE_INITIALIZERS'.format(
                tensor_or_op, e.op)) from e
Wrapper when calling func to re-raise exceptions.
tensorflow_transform/graph_tools.py