Netflix / dgs-framework

GraphQL for Java with Spring Boot made easy.
https://netflix.github.io/dgs
Apache License 2.0
3.06k stars 295 forks source link

documentation: error handling example is outdated for currentl graphql-java version #1832

Open Patrickkooijman opened 7 months ago

Patrickkooijman commented 7 months ago

What are you missing in the docs

The error-handling page shows an example which ends with a delegate call to handle other exceptions then MyException.`

return DataFetcherExceptionHandler.super.handleException(handlerParameters);

This default method was however deprecated and is removed in graphql-java 21.3, https://github.com/graphql-java/graphql-java/commit/1021219732d24866fb5957d8d8dc473b5d588f03

paulbakker commented 7 months ago

Updated the title to reflect it's about the graphql-java version, not Java itself.

Thanks for reporting @Patrickkooijman, we missed that.

awesor commented 5 months ago

Out of curiosity for someone who found this issue as they were upgrading versions and has a reference to that exact line of code in their codebase that's causing strife, what is the recommended line of code here (until of course the docs are updated) for a default handling of exceptions? Should we just not have a default case?

Thanks again @Patrickkooijman for reporting this!

ChristopherGustafson commented 5 months ago

I solved this by creating an instance of SimpleDataFetcherExceptionHandler myself, and then calling simpleDataFetcherExceptionHandler.handleException() instead of super.handleException(). Similar to how the initial implementation looked like.