fix: log init exceptions

This commit is contained in:
Vlad Stan 2022-12-09 10:31:29 +02:00
parent 0d4954c01a
commit 60bb556f2c

View file

@ -137,19 +137,23 @@ def register_startup(app: FastAPI):
@app.on_event("startup") @app.on_event("startup")
async def lnbits_startup(): async def lnbits_startup():
# 1. wait till migration is done try:
await migrate_databases() # 1. wait till migration is done
await migrate_databases()
# 2. setup admin settings # 2. setup admin settings
await check_admin_settings() await check_admin_settings()
log_server_info() log_server_info()
# 3. initialize WALLET # 3. initialize WALLET
set_wallet_class() set_wallet_class()
# 4. initialize funding source # 4. initialize funding source
await check_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(): def log_server_info():