ote discord notifikace error
Some checks failed
CI and deploy / migration-check (push) Failing after 13s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-29 14:07:42 +02:00
parent 93193fd5dc
commit 2eeab58c8e
3 changed files with 65 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import httpx
from app.config import get_settings
from app.db_json import fetch_json
from services.notification_service import notify_ote_import_format_changed
logger = logging.getLogger(__name__)
@@ -170,6 +171,17 @@ async def import_ote_prices_for_day(
except Exception as e:
detail = str(e).strip() or e.__class__.__name__
logger.error("OTE import DB error pro %s: %s", day_str, detail, exc_info=True)
if (
"OTE price dataLine not found" in detail
or "OTE price series:" in detail
or "cannot parse date from graph.title" in detail
):
await notify_ote_import_format_changed(
conn,
report_date=day_str,
error_detail=detail,
url=OTE_URL.format(date=day_str),
)
short = detail[:200] if len(detail) > 200 else detail
return -1, day_str, 0.0, f"db_import:{e.__class__.__name__}: {short}"
@@ -318,5 +330,16 @@ async def import_ote_prices(
except Exception as e:
detail = str(e).strip() or e.__class__.__name__
logger.error("OTE import DB error: %s", detail, exc_info=True)
if (
"OTE price dataLine not found" in detail
or "OTE price series:" in detail
or "cannot parse date from graph.title" in detail
):
await notify_ote_import_format_changed(
db,
report_date=date_str,
error_detail=detail,
url=OTE_URL.format(date=date_str),
)
short = detail[:200] if len(detail) > 200 else detail
return -1, date_str, 0.0, f"db_import:{e.__class__.__name__}: {short}"