Error thrown in custom handler fails #1090
Labels
status: feedback-provided
Feedback has been provided
status: waiting-for-triage
An issue we've not yet triaged
If my handler throws an error, then
DataFetcherHandlerMethod
(line 239) returnsMono.error(..)
, and thenAnnotatedControllerExceptionResolver
(line 241) tries to convert it toMono
again, which givesClassCastException
spring-graphql/spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/AnnotatedControllerExceptionResolver.java
Lines 239 to 241 in 381c9f3
Specifically, in my case I see I threw an error from my handler
@GraphQlExceptionHandler fun handle(...): List<GraphQLError> {...}
that ended up here:After that, the
Mono.error
with my exception is attempted to be cast to the return type of my handler here:spring-graphql/spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/AnnotatedControllerExceptionResolver.java
Lines 444 to 449 in 381c9f3
Line 446 evaluates to
false
because it is instance ofMono
and it tried to cast it toCollection<GraphQLError>
and then fails.And finally, I don't even get to see my actual error that got thrown in my exception handler in the logs, all I can see are these:
The text was updated successfully, but these errors were encountered: