ote discord notifikace error
This commit is contained in:
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user