From 3f140db1d65dd91c267b93f95facbc98969b1bd1 Mon Sep 17 00:00:00 2001 From: Andrew Liu Date: Thu, 16 May 2024 13:04:39 -0700 Subject: [PATCH] Raise value error and add comment --- src/sentry/replays/usecases/query/__init__.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/sentry/replays/usecases/query/__init__.py b/src/sentry/replays/usecases/query/__init__.py index 0fad1c1e4a9d9..3d1448c536a9e 100644 --- a/src/sentry/replays/usecases/query/__init__.py +++ b/src/sentry/replays/usecases/query/__init__.py @@ -70,13 +70,9 @@ def handle_viewed_by_me_filters( value = value.lower() == "true" if request_user_id is None: - if value: # use an always-false filter so query returns nothing - return [ - SearchFilter(SearchKey("id"), "=", SearchValue("a" * 32)), - "AND", - SearchFilter(SearchKey("id"), "!=", SearchValue("a" * 32)), - ] - return [] + # This case will only occur from programmer error. + # Note the replay index endpoint returns 401 automatically for unauthorized and anonymous users. + raise ValueError("Invalid user id") operator = "=" if value else "!=" new_filters.append(