Commit 89729f5f authored by jaster's avatar jaster Committed by jaster

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):
an_importer.manage_rep(rep)
elif rep['chambre'] == 'SEN':
sen_importer.manage_rep(rep)
except Exception as err:
logger.debug('error trying to import rep %s (%s)',
str(rep), str(err))
except Exception:
logger.exception('error trying to import rep %s', str(rep))
......@@ -422,9 +422,8 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'):
try:
importer.manage_mep(data)
except Exception as err:
logger.debug('error trying to import rep %s (%s)',
str(data), str(err))
except Exception:
logger.exception('error trying to import rep %s', str(data))
# Commenting for now, it's a bit dangerous, if a json file was corrupt it
# would drop valid data !
......
......@@ -84,9 +84,8 @@ class PositionImporter:
row['first_name'], row['last_name'], row['url']))
return True
except Exception as err:
logger.debug('error trying to import position %s (%s)',
str(row), str(err))
except Exception:
logger.exception('error trying to import position %s', str(row))
return False
......
......@@ -90,9 +90,9 @@ class RecommendationImporter:
))
return True
except Exception as err:
logger.debug('error trying to import recommendation %s (%s)',
str(row), str(err))
except Exception:
logger.exception('error trying to import recommendation %s',
str(row))
return False
......
......@@ -136,6 +136,5 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'):
try:
parse_dossier_data(data, an, sen)
except Exception as err:
logger.debug('error trying to import dossier %s (%s)',
str(data), str(err))
except Exception:
logger.exception('error trying to import dossier %s', str(data))
......@@ -108,6 +108,5 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'):
try:
importer.parse_scrutin_data(data)
except Exception as err:
logger.debug('error trying to import scrutin %s (%s)',
str(data), str(err))
except Exception:
logger.exception('error trying to import scrutin %s', str(data))
......@@ -128,8 +128,7 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'):
try:
importer.parse_vote_data(data)
except Exception as err:
logger.debug('error trying to import vote %s (%s)',
str(data), str(err))
except Exception:
logger.exception('error trying to import vote %s', str(data))
importer.update_totals()
......@@ -96,6 +96,5 @@ def main(stream=None):
for data in ijson.items(stream or sys.stdin, 'item'):
try:
parse_dossier_data(data, ep)
except Exception as err:
logger.debug('error trying to import dossier %s (%s)',
str(data), str(err))
except Exception:
logger.exception('error trying to import dossier %s', str(data))
......@@ -257,6 +257,5 @@ def main(stream=None):
for vote_data in ijson.items(stream or sys.stdin, 'item'):
try:
command.parse_vote_data(vote_data)
except Exception as err:
logger.debug('error trying to import vote %s (%s)',
str(vote_data), str(err))
except Exception:
logger.exception('error trying to import vote %s', str(vote_data))
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