Skip to content

Commit 0cb95d0

Browse files
committed
Consistent logging in annotated exception handler
This commit aligns DEBUG logging of exceptions resolved via annotated exception handler methods with ExceptionResolversExceptionHandler and the reference documentation. Closes gh-996
1 parent e43ef3a commit 0cb95d0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/AnnotatedControllerExceptionResolver.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,17 @@ private Mono<List<GraphQLError>> invokeExceptionHandler(
237237

238238
Object result = exceptionHandler.invoke(env, arguments);
239239

240-
return methodReturnValueAdapter.adapt(result, exception);
240+
Mono<List<GraphQLError>> errorsMono = methodReturnValueAdapter.adapt(result, exception);
241+
if (logger.isDebugEnabled()) {
242+
errorsMono = errorsMono.doOnNext((errors) -> {
243+
if (logger.isDebugEnabled()) {
244+
String name = exception.getClass().getSimpleName();
245+
logger.debug("Resolved " + name + " to GraphQL error(s): " + errors, exception);
246+
}
247+
});
248+
}
249+
250+
return errorsMono;
241251
}
242252
catch (Throwable invocationEx) {
243253
// Any other than the original exception (or a cause) is unintended here,

0 commit comments

Comments
 (0)