Commit 89729f5f authored by jaster's avatar jaster Committed by tom
Browse files

Change data import errors log to use `exception`

Use the `exception` log method for better exception logging. This change the log
level to 'ERROR'
parent b0cb38ec
...@@ -385,6 +385,5 @@ def main(stream=None): ...@@ -385,6 +385,5 @@ def main(stream=None):
an_importer.manage_rep(rep) an_importer.manage_rep(rep)
elif rep['chambre'] == 'SEN': elif rep['chambre'] == 'SEN':
sen_importer.manage_rep(rep) sen_importer.manage_rep(rep)
except Exception as err: except Exception:
logger.debug('error trying to import rep %s (%s)', logger.exception('error trying to import rep %s', str(rep))
str(rep), str(err))
...@@ -422,9 +422,8 @@ def main(stream=None): ...@@ -422,9 +422,8 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'): for data in ijson.items(stream or sys.stdin, 'item'):
try: try:
importer.manage_mep(data) importer.manage_mep(data)
except Exception as err: except Exception:
logger.debug('error trying to import rep %s (%s)', logger.exception('error trying to import rep %s', str(data))
str(data), str(err))
# Commenting for now, it's a bit dangerous, if a json file was corrupt it # Commenting for now, it's a bit dangerous, if a json file was corrupt it
# would drop valid data ! # would drop valid data !
......
...@@ -84,9 +84,8 @@ class PositionImporter: ...@@ -84,9 +84,8 @@ class PositionImporter:
row['first_name'], row['last_name'], row['url'])) row['first_name'], row['last_name'], row['url']))
return True return True
except Exception as err: except Exception:
logger.debug('error trying to import position %s (%s)', logger.exception('error trying to import position %s', str(row))
str(row), str(err))
return False return False
......
...@@ -90,9 +90,9 @@ class RecommendationImporter: ...@@ -90,9 +90,9 @@ class RecommendationImporter:
)) ))
return True return True
except Exception as err: except Exception:
logger.debug('error trying to import recommendation %s (%s)', logger.exception('error trying to import recommendation %s',
str(row), str(err)) str(row))
return False return False
......
...@@ -136,6 +136,5 @@ def main(stream=None): ...@@ -136,6 +136,5 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'): for data in ijson.items(stream or sys.stdin, 'item'):
try: try:
parse_dossier_data(data, an, sen) parse_dossier_data(data, an, sen)
except Exception as err: except Exception:
logger.debug('error trying to import dossier %s (%s)', logger.exception('error trying to import dossier %s', str(data))
str(data), str(err))
...@@ -108,6 +108,5 @@ def main(stream=None): ...@@ -108,6 +108,5 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'): for data in ijson.items(stream or sys.stdin, 'item'):
try: try:
importer.parse_scrutin_data(data) importer.parse_scrutin_data(data)
except Exception as err: except Exception:
logger.debug('error trying to import scrutin %s (%s)', logger.exception('error trying to import scrutin %s', str(data))
str(data), str(err))
...@@ -128,8 +128,7 @@ def main(stream=None): ...@@ -128,8 +128,7 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'): for data in ijson.items(stream or sys.stdin, 'item'):
try: try:
importer.parse_vote_data(data) importer.parse_vote_data(data)
except Exception as err: except Exception:
logger.debug('error trying to import vote %s (%s)', logger.exception('error trying to import vote %s', str(data))
str(data), str(err))
importer.update_totals() importer.update_totals()
...@@ -96,6 +96,5 @@ def main(stream=None): ...@@ -96,6 +96,5 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'): for data in ijson.items(stream or sys.stdin, 'item'):
try: try:
parse_dossier_data(data, ep) parse_dossier_data(data, ep)
except Exception as err: except Exception:
logger.debug('error trying to import dossier %s (%s)', logger.exception('error trying to import dossier %s', str(data))
str(data), str(err))
...@@ -257,6 +257,5 @@ def main(stream=None): ...@@ -257,6 +257,5 @@ def main(stream=None):
for vote_data in ijson.items(stream or sys.stdin, 'item'): for vote_data in ijson.items(stream or sys.stdin, 'item'):
try: try:
command.parse_vote_data(vote_data) command.parse_vote_data(vote_data)
except Exception as err: except Exception:
logger.debug('error trying to import vote %s (%s)', logger.exception('error trying to import vote %s', str(vote_data))
str(vote_data), str(err))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment