You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This is really confusing to me, as why would I spend effort building up GraphQLError if it's just going to be discarted here? Here is some context:
I created my own DataFetcherExceptionHandler in order to catch some exceptions like IllegalArgumentException, MyServiceException and add an error code inside extensions.errorCode. (btw, I could not find a better way of integrating it other than creating a Spring Bean of new AsyncExecutionStrategy(dataFetcherExceptionHandler) )
Then, I ran the code and I see that I only have the contents of GenericGraphQLError returned to the client. I can see that this class (GraphQLErrorFromExceptionHandler) takes MyCustomGraphQLError, tries to convert it into a Throwable and then back to GraphQLError but without considering any fields I populated (except for the message).
I see, that DefaultGraphQLErrorHandler doesn't do that. I added this property graphql.servlet.exception-handlers-enabled: true because I wanted to use @ExceptionHandler annotations, but that didn't work for me (#309).
Anyway, this is just to understand, why would you want to strip so much information from the errors?
The text was updated successfully, but these errors were encountered:
I can provide an @ExceptionHandler that returns GraphQLError and in that case GraphQLErrorFromExceptionHandler will simply pass it as is, so that approach is preferred.
I found there this code:
This is really confusing to me, as why would I spend effort building up
GraphQLError
if it's just going to be discarted here? Here is some context:I created my own
DataFetcherExceptionHandler
in order to catch some exceptions likeIllegalArgumentException
,MyServiceException
and add an error code insideextensions.errorCode
. (btw, I could not find a better way of integrating it other than creating a Spring Bean ofnew AsyncExecutionStrategy(dataFetcherExceptionHandler)
)Then, I ran the code and I see that I only have the contents of
GenericGraphQLError
returned to the client. I can see that this class (GraphQLErrorFromExceptionHandler
) takesMyCustomGraphQLError
, tries to convert it into aThrowable
and then back toGraphQLError
but without considering any fields I populated (except for themessage
).I see, that
DefaultGraphQLErrorHandler
doesn't do that. I added this propertygraphql.servlet.exception-handlers-enabled: true
because I wanted to use@ExceptionHandler
annotations, but that didn't work for me (#309).Anyway, this is just to understand, why would you want to strip so much information from the errors?
The text was updated successfully, but these errors were encountered: