From 6189206577786426b97fcbb7f84f1a06caf0c9cf Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 4 Jul 2019 17:03:10 +0300 Subject: Add: catching of, logging exceptions --- api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index a20b8fc..bbdc7d7 100755 --- a/api.py +++ b/api.py @@ -306,7 +306,13 @@ def main(): app = bottle.Bottle() pubkey = get_key_from_file(pubkey_filename) api.setup(app, pubkey) - app.run(host=HOST, port=PORT) + try: + app.run(host=HOST, port=PORT) + except SystemExit as e: + logging.info('Terminating normally') + except Exception as e: + logging.error('Caught exception %s', str(e)) + sys.exit(1) main() -- cgit v1.2.1