def _AddHuntErrorToCollection(self, error, collection_urn):
    # TODO(user) Change to use StaticAdd once all active hunts are
    # migrated.
    try:
      aff4.FACTORY.Open(collection_urn,
                        "HuntErrorCollection",
                        mode="rw",
                        token=self.token).Add(error)
    except __HOLE__:
      aff4_collections.PackedVersionedCollection.AddToCollection(
          collection_urn, [error], sync=False, token=self.token)
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/GRRHunt._AddHuntErrorToCollection