Merge pull request #2243 from vilhelmen/write_error_log_fix

Try to create exception str before logging
This commit is contained in:
Min RK
2018-10-19 10:27:16 +02:00
committed by GitHub

View File

@@ -103,7 +103,11 @@ class APIHandler(BaseHandler):
status_message = reason status_message = reason
if exception and isinstance(exception, SQLAlchemyError): if exception and isinstance(exception, SQLAlchemyError):
self.log.warning("Rolling back session due to database error %s", exception) try:
exception_str = str(exception)
self.log.warning("Rolling back session due to database error %s", exception_str)
except Exception:
self.log.warning("Rolling back session due to database error %s", type(exception))
self.db.rollback() self.db.rollback()
self.set_header('Content-Type', 'application/json') self.set_header('Content-Type', 'application/json')