Skip to content

Commit

Permalink
Merge pull request quarkusio#20090 from phillip-kruger/graphql-dfe-in…
Browse files Browse the repository at this point in the history
…-dev

Change the default for `printDatafetcherException` to true in Dev Mode
  • Loading branch information
jmartisk authored Sep 13, 2021
2 parents 7a5c94d + b0892d5 commit 7fbc27f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public class SmallRyeGraphQLConfig {
Optional<String> defaultErrorMessage;

/**
* Print the data fetcher exception to the log file.
* Print the data fetcher exception to the log file. Default `true` in dev and test mode, default `false` in prod.
*/
@ConfigItem(defaultValue = "false")
boolean printDataFetcherException;
@ConfigItem
Optional<Boolean> printDataFetcherException;

/**
* Make the schema available over HTTP.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,22 @@ private Set<String> getAllReferenceClasses(Reference reference) {
return classes;
}

@BuildStep
void printDataFetcherExceptionInDevMode(SmallRyeGraphQLConfig graphQLConfig,
LaunchModeBuildItem launchMode,
BuildProducer<SystemPropertyBuildItem> systemProperties) {

// User did not set this explisitly
if (!graphQLConfig.printDataFetcherException.isPresent()) {
if (launchMode.getLaunchMode().isDevOrTest()) {
systemProperties.produce(new SystemPropertyBuildItem(ConfigKey.PRINT_DATAFETCHER_EXCEPTION, TRUE));
}
} else {
systemProperties.produce(new SystemPropertyBuildItem(ConfigKey.PRINT_DATAFETCHER_EXCEPTION,
String.valueOf(graphQLConfig.printDataFetcherException.get())));
}
}

// Services Integrations

@BuildStep
Expand Down

0 comments on commit 7fbc27f

Please sign in to comment.