Skip to content

Commit 40dca69

Browse files
committed
Change the error response from a 404 to 400.
1 parent 151080e commit 40dca69

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/sentry/workflow_engine/endpoints/organization_project_detector_index.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from sentry.api.api_publish_status import ApiPublishStatus
1010
from sentry.api.base import cell_silo_endpoint
1111
from sentry.api.bases.project import ProjectEndpoint, ProjectPermission
12-
from sentry.api.exceptions import ResourceDoesNotExist
1312
from sentry.api.serializers import serialize
1413
from sentry.apidocs.constants import (
1514
RESPONSE_BAD_REQUEST,
@@ -73,7 +72,10 @@ def post(self, request: Request, project: Project) -> Response:
7372
if detector_type == MetricIssue.slug and not features.has(
7473
"organizations:incidents", organization, actor=request.user
7574
):
76-
raise ResourceDoesNotExist
75+
return Response(
76+
serialize({"detail": "Unable to process request, confirm payment options."}),
77+
status=status.HTTP_400_BAD_REQUEST,
78+
)
7779

7880
validator = get_detector_validator(request, project, detector_type)
7981
if not validator.is_valid():

tests/sentry/workflow_engine/endpoints/test_organization_project_detector_index.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ def test_without_feature_flag(self) -> None:
155155
self.organization.slug,
156156
self.project.slug,
157157
**self.valid_data,
158-
status_code=404,
158+
status_code=400,
159159
)
160160
assert response.data == {
161-
"detail": ErrorDetail(string="The requested resource does not exist", code="error")
161+
"detail": ErrorDetail(
162+
string="Unable to process request, confirm payment options.", code="error"
163+
)
162164
}
163165

164166
def test_project_not_found(self) -> None:

0 commit comments

Comments
 (0)