def ReadFileObject(self, file_object):
    """Reads artifact definitions from a file-like object.

    Args:
      file_object (file): file-like object to read from.

    Yields:
      ArtifactDefinition: an artifact definition.

    Raises:
      FormatError: if the format of the JSON artifact definition is not set
          or incorrect.
    """
    # TODO: add try, except?
    json_definitions = json.loads(file_object.read())

    last_artifact_definition = None
    for json_definition in json_definitions:
      try:
        artifact_definition = self.ReadArtifactDefinitionValues(json_definition)
      except errors.FormatError as exception:
        error_location = 'At start'
        if last_artifact_definition:
          error_location = 'After: {0:s}'.format(last_artifact_definition.name)

        raise errors.FormatError(
            '{0:s} {1!s}'.format(error_location, exception))

      yield artifact_definition
      last_artifact_definition = artifact_definition
Reads artifact definitions from a file-like object.

    Args:
      file_object (file): file-like object to read from.

    Yields:
      ArtifactDefinition: an artifact definition.

    Raises:
      FormatError: if the format of the JSON artifact definition is not set
          or incorrect.