Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 0a83f13

Browse files
committed
Fix issue with error handler
1 parent c298f43 commit 0a83f13

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,10 @@ public class GraphQLWebAutoConfiguration {
108108
@Bean
109109
public GraphQLErrorStartupListener graphQLErrorStartupListener(
110110
@Autowired(required = false) GraphQLErrorHandler errorHandler) {
111-
return new GraphQLErrorStartupListener(toErrorHandlerSupplier(errorHandler),
111+
return new GraphQLErrorStartupListener(new ErrorHandlerSupplier(errorHandler),
112112
graphQLServletProperties.isExceptionHandlersEnabled());
113113
}
114114

115-
private ErrorHandlerSupplier toErrorHandlerSupplier(GraphQLErrorHandler errorHandler) {
116-
return new ErrorHandlerSupplier(errorHandler);
117-
}
118-
119115
@Bean
120116
@ConditionalOnClass(CorsFilter.class)
121117
@ConfigurationProperties("graphql.servlet.cors")
@@ -265,7 +261,9 @@ public GraphQLObjectMapper graphQLObjectMapper(
265261
@Autowired(required = false) GraphQLErrorHandler errorHandler) {
266262
GraphQLObjectMapper.Builder builder = newBuilder();
267263

268-
builder.withGraphQLErrorHandler(toErrorHandlerSupplier(errorHandler));
264+
if (errorHandler != null) {
265+
builder.withGraphQLErrorHandler(new ErrorHandlerSupplier(errorHandler));
266+
}
269267

270268
ObjectMapperProvider objectMapperProvider = objectMapperProviderObjectProvider.getIfAvailable();
271269

0 commit comments

Comments
 (0)