error handling a custom ClientException from a Dataloader #2153
-
|
It is my understanding that dataloaders run after the datafetchers return and outside of the normal GQL execution pipeline. This is causing our service's error handling to be skipped, an implementation of DgsDataFetcherExceptionHandler. sudo code: When the API call fails for say some 4xx, I am struggling to throw a custom GraphQLError type from the datafetcher as i cannot access the error from inside the DataFetcherExceptionHandlerParameters (it doesnt exist there of course). There is no documentation about this cause and effect in apollo or DGS, and im wondering what the recommended way to solve this is. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
i figured it out and wanted to document an example for future people who might need support: Overall:
Note that you will need to implement your own createGraphQLError() from your throwable, there are examples of this in the apollo docs |
Beta Was this translation helpful? Give feedback.
i figured it out and wanted to document an example for future people who might need support:
Overall:
Note that you will need to implement your own createGraphQLError() from your throwable, there are examples of this in the apollo docs