Also throw if the record came back but with no references
@@ -19,6 +19,11 @@ class S2PaperNotFoundException(Exception):
which is a requirement for processing.
"""
+class S2ReferencesNotFoundException(Exception):
+ """
+ The target arxiv paper did not have any references available via the S2 public api.
+ """
+
class FetchS2Metadata(ArxivBatchCommand[ArxivId, S2Metadata]):
@staticmethod
def get_name() -> str:
@@ -61,6 +66,9 @@ class FetchS2Metadata(ArxivBatchCommand[ArxivId, S2Metadata]):
)
references.append(reference)
+ if not references:
+ raise S2ReferencesNotFoundException()
+
s2_metadata = S2Metadata(s2_id=data["paperId"], references=references)
logging.debug("Fetched S2 metadata for arXiv paper %s", item)
yield s2_metadata
