aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-07-10 22:47:02 +0200
committerMartin Czygan <martin.czygan@gmail.com>2020-07-10 22:47:02 +0200
commit3e5056b02b22d9df43db0d95ecd770a360dcd357 (patch)
treeb0183d3332cfac1fa72c4ef02f676ea7b0989c2a /python/fatcat_tools
parent46cdaee79737e8fc18de2fc3a8286d0622ec8cdf (diff)
downloadfatcat-3e5056b02b22d9df43db0d95ecd770a360dcd357.tar.gz
fatcat-3e5056b02b22d9df43db0d95ecd770a360dcd357.zip
datacite: mitigate sentry #44035
According to sentry, running `c.get('nameIdentifiers', []) or []` on a c with value: ``` {'affiliation': [], 'familyName': 'Guidon', 'givenName': 'Manuel', 'nameIdentifiers': {'nameIdentifier': 'https://orcid.org/0000-0003-3543-6683', 'nameIdentifierScheme': 'ORCID', 'schemeUri': 'https://orcid.org'}, 'nameType': 'Personal'} ``` results in a string, which I cannot reproduce. The document in question at: https://api.datacite.org/dois/10.26275/kuw1-fdls seems fine, too.
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r--python/fatcat_tools/importers/datacite.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py
index f005f988..785107ee 100644
--- a/python/fatcat_tools/importers/datacite.py
+++ b/python/fatcat_tools/importers/datacite.py
@@ -732,6 +732,10 @@ class DataciteImporter(EntityImporter):
if nameType in ('', 'Personal'):
creator_id = None
for nid in c.get('nameIdentifiers', []) or []:
+ if not isinstance(nid, dict):
+ # see: fatcat-workers/issues/44035/
+ print('unexpected nameIdentifiers, expected list of dicts, got: {}'.format(nid), file=sys.stderr)
+ continue
name_scheme = nid.get('nameIdentifierScheme', '') or ''
if not name_scheme.lower() == "orcid":
continue