You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
685 B

from typing import Optional, List
import strawberry
from graphql import ExecutionContext, GraphQLError
from articles.utils import AuthExtension, GraphQLError as CustomGraphQLError
from .mutations import Mutation
from .queries import Query
class CustomSchema(strawberry.Schema):
def process_errors(self,
errors: List[GraphQLError],
execution_context: Optional[ExecutionContext] = None):
super().process_errors(
[e for e in errors if not isinstance(e.original_error, CustomGraphQLError)],
execution_context
)
schema = CustomSchema(query=Query, mutation=Mutation, extensions=[AuthExtension])