Skip to content

Commit

Permalink
Ignore Custom app level graphql errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thenav56 committed Aug 23, 2024
1 parent 9d405e5 commit 8cd4de2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions main/graphql/permissions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import typing

from asgiref.sync import sync_to_async
from strawberry.exceptions import StrawberryGraphQLError as OgStrawberryGraphQLError
from strawberry.permission import BasePermission
from strawberry.types import Info

if typing.TYPE_CHECKING:
from graphql import GraphQLError


class StrawberryGraphQLError(OgStrawberryGraphQLError):
pass


class IsAuthenticated(BasePermission):
error_class: typing.Type["GraphQLError"] = StrawberryGraphQLError
message = "User is not authenticated"

@sync_to_async
Expand Down
5 changes: 3 additions & 2 deletions main/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from sentry_sdk.integrations.logging import ignore_logger
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations.strawberry import StrawberryIntegration
from strawberry.permission import BasePermission

from main.graphql.permissions import StrawberryGraphQLError

IGNORED_ERRORS = [
BasePermission,
StrawberryGraphQLError,
]
IGNORED_LOGGERS = [
"graphql.execution.utils",
Expand Down

0 comments on commit 8cd4de2

Please sign in to comment.