Skip to content

Commit

Permalink
better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rettinghaus committed Feb 23, 2021
1 parent f102e3b commit f5fca1a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions csv2cmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ def createCorrespondent(nameString):
except urllib.error.HTTPError:
logging.error(
'Authority file not found for %sID in line %s', nameString, table.line_num)
except urllib.error.URLError:
logging.error('Failed to reach VIAF')
except urllib.error.URLError as e:
logging.error(
'Failed to reach VIAF (' + str(e.reason) + ')')
else:
viafrdf_root = viafrdf.getroot()
if viafrdf_root.find('./rdf:Description/rdf:type[@rdf:resource="http://schema.org/Organization"]', ns) is not None:
Expand Down Expand Up @@ -259,8 +260,9 @@ def createCorrespondent(nameString):
except urllib.error.HTTPError:
logging.error(
'Authority file not found for %sID in line %s', nameString, table.line_num)
except urllib.error.URLError:
logging.error('Failed to reach LOC')
except urllib.error.URLError as e:
logging.error(
'Failed to reach LOC (' + str(e.reason) + ')')
else:
locrdf_root = locrdf.getroot()
if locrdf_root.find('.//rdf:type[@rdf:resource="http://id.loc.gov/ontologies/bibframe/Organization"]', ns) is not None:
Expand Down

0 comments on commit f5fca1a

Please sign in to comment.