From f71e33186320ad67c482b1b5058928e713983213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Obermu=CC=88ller?= Date: Thu, 2 Jan 2025 09:13:50 +0100 Subject: [PATCH] ignore all exceptions --- posthog/api/insight.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/posthog/api/insight.py b/posthog/api/insight.py index 3b4109ce59385..924850d51f07b 100644 --- a/posthog/api/insight.py +++ b/posthog/api/insight.py @@ -1,5 +1,6 @@ import json from functools import lru_cache +import logging from typing import Any, Optional, Union, cast import posthoganalytics @@ -173,17 +174,21 @@ def log_and_report_insight_activity( def capture_legacy_api_call(request: request.Request, team: Team): - event = "legacy insight endpoint called" - distinct_id: str = request.user.distinct_id # type: ignore - properties = { - "path": request._request.path, - "method": request._request.method, - "use_hogql": False, - "filter": get_filter(request=request, team=team), - "was_impersonated": is_impersonated_session(request), - } - - posthoganalytics.capture(distinct_id, event, properties, groups=(groups(team.organization, team))) + try: + event = "legacy insight endpoint called" + distinct_id: str = request.user.distinct_id # type: ignore + properties = { + "path": request._request.path, + "method": request._request.method, + "use_hogql": False, + "filter": get_filter(request=request, team=team), + "was_impersonated": is_impersonated_session(request), + } + + posthoganalytics.capture(distinct_id, event, properties, groups=(groups(team.organization, team))) + except Exception as e: + logging.exception(f"Error in capture_legacy_api_call: {e}") + pass class QuerySchemaParser(JSONParser):