Log exceptions raised under the servers module.

This commit is contained in:
Ashesh Vashi 2016-03-17 22:50:38 +05:30
parent 71badac203
commit 1448a8f551

View File

@ -278,6 +278,7 @@ class ServerNode(PGChildNodeView):
db.session.delete(s) db.session.delete(s)
db.session.commit() db.session.commit()
except Exception as e: except Exception as e:
current_app.logger.exception(e)
return make_json_response( return make_json_response(
success=0, success=0,
errormsg=e.message) errormsg=e.message)
@ -285,6 +286,7 @@ class ServerNode(PGChildNodeView):
try: try:
info = traceback.format_exc() info = traceback.format_exc()
except Exception as e: except Exception as e:
current_app.logger.exception(e)
info = str(e) info = str(e)
return make_json_response(success=1, return make_json_response(success=1,
@ -357,6 +359,7 @@ class ServerNode(PGChildNodeView):
try: try:
db.session.commit() db.session.commit()
except Exception as e: except Exception as e:
current_app.logger.exception(e)
return make_json_response( return make_json_response(
success=0, success=0,
errormsg=e.message errormsg=e.message
@ -509,6 +512,7 @@ class ServerNode(PGChildNodeView):
) )
except Exception as e: except Exception as e:
current_app.logger.exception(e)
return make_json_response( return make_json_response(
status=410, status=410,
success=0, success=0,
@ -618,6 +622,7 @@ class ServerNode(PGChildNodeView):
password = encrypt(password, user.password) \ password = encrypt(password, user.password) \
if password is not None else server.password if password is not None else server.password
except Exception as e: except Exception as e:
current_app.logger.exception(e)
return internal_server_error(errormsg=e.message) return internal_server_error(errormsg=e.message)
# Connect the Server # Connect the Server
@ -631,6 +636,7 @@ class ServerNode(PGChildNodeView):
server_types=ServerType.types() server_types=ServerType.types()
) )
except Exception as e: except Exception as e:
current_app.logger.exception(e)
# TODO:: # TODO::
# Ask the password again (if existing password couldn't be # Ask the password again (if existing password couldn't be
# descrypted) # descrypted)
@ -666,6 +672,7 @@ class ServerNode(PGChildNodeView):
db.session.commit() db.session.commit()
except Exception as e: except Exception as e:
# Release Connection # Release Connection
current_app.logger.exception(e)
manager.release(database=server.maintenance_db) manager.release(database=server.maintenance_db)
conn = None conn = None