Skip to content

Commit 2308e3c

Browse files
committed
feat(refactor): Move common exceptions out of the discover db
Move IssueSearchQueryException to common exceptions module Remove future annotation Remove future annotation
1 parent 9e38023 commit 2308e3c

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

src/sentry/incidents/utils/process_update_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from sentry.incidents.utils.types import QuerySubscriptionUpdate
77
from sentry.search.eap.utils import add_start_end_conditions
8-
from sentry.search.events.datasets.discover import InvalidIssueSearchQuery
8+
from sentry.search.exceptions import InvalidIssueSearchQuery
99
from sentry.snuba.dataset import Dataset
1010
from sentry.snuba.entity_subscription import (
1111
ENTITY_TIME_COLUMNS,

src/sentry/search/eap/resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
from sentry.search.events import constants as qb_constants
6565
from sentry.search.events import fields
6666
from sentry.search.events import filter as event_filter
67-
from sentry.search.events.datasets.discover import InvalidIssueSearchQuery
6867
from sentry.search.events.filter import to_list
6968
from sentry.search.events.types import SAMPLING_MODES, SnubaParams
69+
from sentry.search.exceptions import InvalidIssueSearchQuery
7070

7171

7272
def collect_issue_short_ids_from_parsed_terms(terms: Sequence[object]) -> set[str]:

src/sentry/search/events/datasets/discover.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,13 @@
9595
)
9696
from sentry.search.events.filter import to_list
9797
from sentry.search.events.types import SelectType, WhereType
98+
from sentry.search.exceptions import InvalidIssueSearchQuery
9899
from sentry.search.utils import DEVICE_CLASS
99100
from sentry.snuba.dataset import Dataset
100101
from sentry.snuba.referrer import Referrer
101102
from sentry.utils.numbers import format_grouped_length
102103

103104

104-
class InvalidIssueSearchQuery(InvalidSearchQuery):
105-
"""Raised when an issue filter references non-existent issue IDs."""
106-
107-
def __init__(self, invalid_ids: list[str]):
108-
self.invalid_ids = invalid_ids
109-
super().__init__(f"Issue IDs do not exist: {invalid_ids}")
110-
111-
def __str__(self) -> str:
112-
return f"Issue IDs do not exist: {self.invalid_ids}"
113-
114-
115105
class DiscoverDatasetConfig(DatasetConfig):
116106
custom_threshold_columns = {
117107
"apdex()",

src/sentry/search/exceptions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from sentry.exceptions import InvalidSearchQuery
2+
3+
4+
class InvalidIssueSearchQuery(InvalidSearchQuery):
5+
"""Raised when an issue filter references non-existent issue IDs."""
6+
7+
def __init__(self, invalid_ids: list[str]):
8+
self.invalid_ids = invalid_ids
9+
super().__init__(f"Issue IDs do not exist: {invalid_ids}")
10+
11+
def __str__(self) -> str:
12+
return f"Issue IDs do not exist: {self.invalid_ids}"

tests/sentry/incidents/utils/test_process_update_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from sentry.incidents.utils.process_update_helpers import get_aggregation_value
77
from sentry.incidents.utils.types import QuerySubscriptionUpdate
8-
from sentry.search.events.datasets.discover import InvalidIssueSearchQuery
8+
from sentry.search.exceptions import InvalidIssueSearchQuery
99
from sentry.snuba.dataset import Dataset
1010
from sentry.snuba.entity_subscription import get_entity_subscription_from_snuba_query
1111
from sentry.snuba.models import SnubaQuery, SnubaQueryEventType

0 commit comments

Comments
 (0)