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

fix(#611): allow exception handlers to be disabled #614

Merged
merged 2 commits into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public GraphQLErrorHandler create(
.flatMap(List::stream)
.collect(toList());

if (!factories.isEmpty() || exceptionHandlersEnabled) {
if (exceptionHandlersEnabled) {
log.debug(
"Handle GraphQL errors using exception handlers defined in {} custom factories",
factories.size());
Expand All @@ -43,7 +43,7 @@ private List<GraphQLErrorFactory> scanForExceptionHandlers(
try {
Class<?> objClz = context.getType(name);
if (objClz == null) {
log.info("Cannot load class " + name);
log.info("Cannot load class {}", name);
return emptyList();
}
return Arrays.stream(objClz.getDeclaredMethods())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public GraphQLErrorHandlerTest() {
@BeforeEach
public void setUp() {
System.setProperty("graphql.tools.schemaLocationPattern", "graphql/error-handler-test.graphql");
System.setProperty("graphql.servlet.exception-handlers-enabled", "true");
load(BaseConfiguration.class);

GraphQLSchema schema = getContext().getBean(GraphQLSchema.class);
Expand Down