Skip to content

Commit 621d9a8

Browse files
committed
telemetry: copilot suggestion fixes
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent 7eb1a35 commit 621d9a8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

api/main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,13 @@ def _build_events_query(query_params: dict) -> tuple:
896896

897897
if from_ts:
898898
if isinstance(from_ts, str):
899-
from_ts = datetime.fromisoformat(from_ts)
899+
try:
900+
from_ts = datetime.fromisoformat(from_ts)
901+
except ValueError as exc:
902+
raise HTTPException(
903+
status_code=status.HTTP_400_BAD_REQUEST,
904+
detail="Invalid 'from' parameter, must be an ISO 8601 datetime"
905+
) from exc
900906
query_params['timestamp'] = {'$gt': from_ts}
901907
if path:
902908
query_params['data.path'] = {'$regex': path}

0 commit comments

Comments
 (0)