From 5a0b0ed47982e1616fa0be500c7fcf2968d7a594 Mon Sep 17 00:00:00 2001 From: dylan Date: Mon, 5 Aug 2024 14:13:28 -0700 Subject: [PATCH] extend capture endpoint utils to include new type of error --- posthog/api/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/posthog/api/utils.py b/posthog/api/utils.py index 155a4f7840bad..6c38ba3ea4700 100644 --- a/posthog/api/utils.py +++ b/posthog/api/utils.py @@ -22,7 +22,11 @@ from statshog.defaults.django import statsd from posthog.constants import EventDefinitionType -from posthog.exceptions import RequestParsingError, generate_exception_response +from posthog.exceptions import ( + RequestParsingError, + UnspecifiedCompressionFallbackParsingError, + generate_exception_response, +) from posthog.models import Entity, EventDefinition from posthog.models.entity import MathType from posthog.models.filters.filter import Filter @@ -182,7 +186,7 @@ def get_data(request): data = None try: data = load_data_from_request(request) - except RequestParsingError as error: + except (RequestParsingError, UnspecifiedCompressionFallbackParsingError) as error: statsd.incr("capture_endpoint_invalid_payload") logger.exception(f"Invalid payload", error=error) return (