Netflix / dgs-framework

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

bug: Custom exceptions handler not getting invoked when using DGS framework with Kotlin #1341

Closed abhinav82ify closed 1 year ago

abhinav82ify commented 1 year ago

Expected behavior

As per https://netflix.github.io/dgs/error-handling/, it is fairly simple to register a custom exception handler. I just need to add a new custom exception handler class and return error response based on the type of exception.

Actual behavior

When my Data fetcher (written in Kotlin) throws an exception, it is never intercepted by the custom exception handler and always throws a generic response Internal Server Error(s) while executing query. I have tried this a 100 times with a debugger now and it never seems to reach the custom exception handler.

Steps to reproduce

  1. A Kotlin based Data fetcher throws a custom exception (MissingDataException)
  2. Register a custom exception handler and add handling for MissingDataException
ClaudenirFreitas commented 1 year ago

Hi @abhinav82ify, I just created this repository with Kotlin to validate this issue and it is working as expected.
Would you like to check, please?

abhinav82ify commented 1 year ago

Hi @ClaudenirFreitas, thanks for the solution. I was able to fix it. There were some dependency mismatch which were causing this.