From 60bb556f2c0e8595993ca9ecf5382c4f2675ccce Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Fri, 9 Dec 2022 10:31:29 +0200 Subject: [PATCH] fix: log init exceptions --- lnbits/app.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lnbits/app.py b/lnbits/app.py index b4a7e0324..b27496f88 100644 --- a/lnbits/app.py +++ b/lnbits/app.py @@ -137,19 +137,23 @@ def register_startup(app: FastAPI): @app.on_event("startup") async def lnbits_startup(): - # 1. wait till migration is done - await migrate_databases() + try: + # 1. wait till migration is done + await migrate_databases() - # 2. setup admin settings - await check_admin_settings() + # 2. setup admin settings + await check_admin_settings() - log_server_info() + log_server_info() - # 3. initialize WALLET - set_wallet_class() + # 3. initialize WALLET + set_wallet_class() - # 4. initialize funding source - await check_funding_source() + # 4. initialize funding source + await check_funding_source() + except Exception as e: + logger.error(str(e)) + raise ImportError("Failed to run 'startup' event.") def log_server_info():