mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-07 10:04:07 +00:00
Try to create exception str before logging
The str() method of an InterfaceError can raise when trying to iterate over an integer, causing the logger to act up.
This commit is contained in:
@@ -103,7 +103,11 @@ class APIHandler(BaseHandler):
|
||||
status_message = reason
|
||||
|
||||
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.set_header('Content-Type', 'application/json')
|
||||
|
Reference in New Issue
Block a user