Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions keep/api/routes/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from fastapi.responses import JSONResponse
from pusher import Pusher
from sqlalchemy_utils import UUIDType
from sqlalchemy.exc import DataError
from sqlmodel import Session

from keep.api.arq_pool import get_pool
Expand Down Expand Up @@ -228,6 +229,14 @@ def query_alerts(
raise HTTPException(
status_code=400, detail=f"Error parsing CEL expression: {query.cel}"
) from e
except DataError as e:
logger.exception(
f'Database type error while executing query "{query.cel}". {str(e)}'
)
raise HTTPException(
status_code=400,
detail=f"Invalid value in query - a field may contain a non-UUID value: {query.cel}",
) from e

db_alerts = enrich_alerts_with_incidents(tenant_id, db_alerts)
enriched_alerts_dto = convert_db_alerts_to_dto_alerts(
Expand Down
Loading