Stage 05.3 - order validation, error handling and journal logging

This commit is contained in:
2026-04-17 13:05:35 +03:00
parent b1b9beef78
commit 604a8c0069
13 changed files with 188 additions and 25 deletions

View File

@@ -13,9 +13,26 @@ from src.trading.journal.service import JournalService
def create_app() -> tuple[Bot, Dispatcher]:
settings = load_settings()
setup_logging(settings.log_level)
init_schema()
journal = JournalService()
try:
init_schema()
except Exception as exc:
try:
journal.log_critical(
"app_bootstrap_failed",
f"Не удалось инициализировать схему БД: {exc}",
{
"env": settings.app_env,
"exchange_name": settings.exchange_name,
"default_symbol": settings.default_symbol,
},
)
except Exception:
pass
raise
try:
journal.log_info(
"app_start",
@@ -37,4 +54,4 @@ def create_app() -> tuple[Bot, Dispatcher]:
dispatcher = Dispatcher()
setup_routers(dispatcher)
return bot, dispatcher
return bot, dispatcher