dgs-framework icon indicating copy to clipboard operation
dgs-framework copied to clipboard

bug: Exceptions thrown from dataFetchers are being thrown as `java.lang.reflect.UndeclaredThrowableException`.

Open maory opened this issue 2 years ago • 2 comments

Expected behavior

DataFetcherExceptionHandler#onExceptionhandlerParameters Will contain the thrown exception.

Actual behavior

DataFetcherExceptionHandler#onExceptionhandlerParameters contains java.lang.reflect.UndeclaredThrowableException, it's cause is the right exception.

Steps to reproduce

  1. Create a simple query.
  2. Create a test class for it
  3. mocked class will throw a custom Exception (inherited from Exception)
  4. set a breakPoint DataFetcherExceptionHandler#onException, see that the exception is java.lang.reflect.UndeclaredThrowableException

Note: DataFetcher does throw the right exception and declares about it.

maory avatar Jun 07 '22 14:06 maory

Hi @maory, we will need a minimal test to reproduce the issue. We use this feature extensibly.

If you need an example, and a way to set some breakpoint, you can look at our MicrometerServletSmokeTest.

berngp avatar Jun 07 '22 21:06 berngp

Hey @berngp, found out this issue https://github.com/graphql-java-kickstart/graphql-java-tools/issues/477 in graphql-java which might be relevant.

The test case can be the same.

maory avatar Jun 08 '22 07:06 maory