mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 09:42:38 -05:00
fix logger.exception syntax
when given any log function with multiple parameters, the python logging utils assume the first param is a format string and the rest are arguments to pass in - we were passing in the exception object to `logger.exception`, however, the purpose of .exception is to add the exception object itself - so we didn't need to
This commit is contained in:
@@ -31,7 +31,7 @@ def run_scheduled_jobs():
|
|||||||
process_job.apply_async([str(job.id)], queue="process-job")
|
process_job.apply_async([str(job.id)], queue="process-job")
|
||||||
current_app.logger.info("Job ID {} added to process job queue".format(job.id))
|
current_app.logger.info("Job ID {} added to process job queue".format(job.id))
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
current_app.logger.exception("Failed to run scheduled jobs", e)
|
current_app.logger.exception("Failed to run scheduled jobs")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ def delete_verify_codes():
|
|||||||
"Delete job started {} finished {} deleted {} verify codes".format(start, datetime.utcnow(), deleted)
|
"Delete job started {} finished {} deleted {} verify codes".format(start, datetime.utcnow(), deleted)
|
||||||
)
|
)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
current_app.logger.exception("Failed to delete verify codes", e)
|
current_app.logger.exception("Failed to delete verify codes")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ def delete_successful_notifications():
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
current_app.logger.exception("Failed to delete successful notifications", e)
|
current_app.logger.exception("Failed to delete successful notifications")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ def delete_failed_notifications():
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
current_app.logger.exception("Failed to delete failed notifications", e)
|
current_app.logger.exception("Failed to delete failed notifications")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ def delete_invitations():
|
|||||||
"Delete job started {} finished {} deleted {} invitations".format(start, datetime.utcnow(), deleted)
|
"Delete job started {} finished {} deleted {} invitations".format(start, datetime.utcnow(), deleted)
|
||||||
)
|
)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
current_app.logger.exception("Failed to delete invitations", e)
|
current_app.logger.exception("Failed to delete invitations")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ def persist_notification(
|
|||||||
queue='send-email' if not research_mode else 'research-mode'
|
queue='send-email' if not research_mode else 'research-mode'
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.exception("Failed to send to SQS exception", e)
|
current_app.logger.exception("Failed to send to SQS exception")
|
||||||
dao_delete_notifications_and_history_by_id(notification_id)
|
dao_delete_notifications_and_history_by_id(notification_id)
|
||||||
raise InvalidRequest(message="Internal server error", status_code=500)
|
raise InvalidRequest(message="Internal server error", status_code=500)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user