Currently the library raises an exception for authentication failures. I think it should be a specific exception class so it can be filtered out more easily.
In my case, I'm overriding strawberry's schema to support an ignoreable collection of exceptions. These won't be passed to the logger and thus avoid the exception handling logic. However, strawberry-django-jwt uses an exception class that's subclassed when a user enters the wrong credentials.
class Schema(strawberry.Schema):
ignored_errors: tuple[Type[Exception]]
def __init__(self, *args, ignored_errors=None, **kwargs):
super().__init__(*args, **kwargs)
self.ignored_errors = ignored_errors
def process_errors(
self,
errors: List[GraphQLError],
execution_context: Optional[ExecutionContext] = None,
) -> None:
for error in errors:
if error.original_error and self.ignored_errors and isinstance(
error.original_error, self.ignored_errors
):
continue
StrawberryLogger.error(error, execution_context)
If it seems reasonable, I can create the PR.
Currently the library raises an exception for authentication failures. I think it should be a specific exception class so it can be filtered out more easily.
In my case, I'm overriding strawberry's schema to support an ignoreable collection of exceptions. These won't be passed to the logger and thus avoid the exception handling logic. However, strawberry-django-jwt uses an exception class that's subclassed when a user enters the wrong credentials.
If it seems reasonable, I can create the PR.