Replies: 1 comment
-
Hello 👋 In older versions you would need to create your own custom ContextWebFilter that would send the error on the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a
SpringGraphQLContextFactory
that decodes a jwt token, at the moment if the token is invalid a 500 error is returned to the client.I would like to send a GraphQLError
AuthenticationError
with codeUNAUTHENTICATED
in a similar way to Apollo Server allows.I cannot send a GraphQLError directly from the context, because it does not have access to the response.
I have looked at using at
DataFetcherExceptionHandler
, but that is only invoked on exceptions that happen during the graphql request excution.Also, I looked at creating my own
SpringGraphQLServer
and handling specific exceptions with a custom error, but this is a bit messy.A specific error could be returned if moved the token validation into the Query/Mutation, but I would like to have it all handled transparently in the Context.
What would be your recommended approach?
Beta Was this translation helpful? Give feedback.
All reactions