Skip to content

Commit fec23c5

Browse files
committed
use DjangoValidationError when deleting tags
1 parent b341641 commit fec23c5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

api/schema/tags_schema.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
from strawberry.types import Info
44

55
from api.models import Tag
6-
from api.schema.base_mutation import BaseMutation, MutationResponse
6+
from api.schema.base_mutation import (
7+
BaseMutation,
8+
DjangoValidationError,
9+
MutationResponse,
10+
)
711
from api.utils.graphql_telemetry import trace_resolver
812
from authorization.permissions import IsAuthenticated
913

@@ -38,6 +42,6 @@ def delete_tags(self, info: Info, tag_ids: list[str]) -> MutationResponse[bool]:
3842
try:
3943
tags = Tag.objects.filter(id__in=tag_ids)
4044
except Tag.DoesNotExist:
41-
raise ValueError(f"Tags with IDs {tag_ids} do not exist.")
45+
raise DjangoValidationError(f"Tags with IDs {tag_ids} do not exist.")
4246
tags.delete()
4347
return MutationResponse.success_response(True)

0 commit comments

Comments
 (0)