File tree Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -80,19 +80,20 @@ partial results with errors.
8080Here is the code for the standard behaviour.
8181
8282{{< highlight java "linenos=table" >}}
83-
8483 public class SimpleDataFetcherExceptionHandler implements DataFetcherExceptionHandler {
85- private static final Logger log = LoggerFactory.getLogger(SimpleDataFetcherExceptionHandler.class);
84+
85+ private static final Logger logNotSafe = LogKit.getNotPrivacySafeLogger(SimpleDataFetcherExceptionHandler.class);
8686
8787 @Override
88- public void accept (DataFetcherExceptionHandlerParameters handlerParameters) {
88+ public DataFetcherExceptionHandlerResult onException (DataFetcherExceptionHandlerParameters handlerParameters) {
8989 Throwable exception = handlerParameters.getException();
90- SourceLocation sourceLocation = handlerParameters.getField(). getSourceLocation();
90+ SourceLocation sourceLocation = handlerParameters.getSourceLocation();
9191 ExecutionPath path = handlerParameters.getPath();
9292
9393 ExceptionWhileDataFetching error = new ExceptionWhileDataFetching(path, exception, sourceLocation);
94- handlerParameters.getExecutionContext().addError(error);
95- log.warn(error.getMessage(), exception);
94+ logNotSafe.warn(error.getMessage(), exception);
95+
96+ return DataFetcherExceptionHandlerResult.newResult().error(error).build();
9697 }
9798 }
9899{{< / highlight >}}
Original file line number Diff line number Diff line change @@ -80,19 +80,20 @@ partial results with errors.
8080Here is the code for the standard behaviour.
8181
8282{{< highlight java "linenos=table" >}}
83-
8483 public class SimpleDataFetcherExceptionHandler implements DataFetcherExceptionHandler {
85- private static final Logger log = LoggerFactory.getLogger(SimpleDataFetcherExceptionHandler.class);
84+
85+ private static final Logger logNotSafe = LogKit.getNotPrivacySafeLogger(SimpleDataFetcherExceptionHandler.class);
8686
8787 @Override
88- public void accept (DataFetcherExceptionHandlerParameters handlerParameters) {
88+ public DataFetcherExceptionHandlerResult onException (DataFetcherExceptionHandlerParameters handlerParameters) {
8989 Throwable exception = handlerParameters.getException();
90- SourceLocation sourceLocation = handlerParameters.getField(). getSourceLocation();
90+ SourceLocation sourceLocation = handlerParameters.getSourceLocation();
9191 ExecutionPath path = handlerParameters.getPath();
9292
9393 ExceptionWhileDataFetching error = new ExceptionWhileDataFetching(path, exception, sourceLocation);
94- handlerParameters.getExecutionContext().addError(error);
95- log.warn(error.getMessage(), exception);
94+ logNotSafe.warn(error.getMessage(), exception);
95+
96+ return DataFetcherExceptionHandlerResult.newResult().error(error).build();
9697 }
9798 }
9899{{< / highlight >}}
Original file line number Diff line number Diff line change @@ -80,19 +80,20 @@ partial results with errors.
8080Here is the code for the standard behaviour.
8181
8282{{< highlight java "linenos=table" >}}
83-
8483 public class SimpleDataFetcherExceptionHandler implements DataFetcherExceptionHandler {
85- private static final Logger log = LoggerFactory.getLogger(SimpleDataFetcherExceptionHandler.class);
84+
85+ private static final Logger logNotSafe = LogKit.getNotPrivacySafeLogger(SimpleDataFetcherExceptionHandler.class);
8686
8787 @Override
88- public void accept (DataFetcherExceptionHandlerParameters handlerParameters) {
88+ public DataFetcherExceptionHandlerResult onException (DataFetcherExceptionHandlerParameters handlerParameters) {
8989 Throwable exception = handlerParameters.getException();
90- SourceLocation sourceLocation = handlerParameters.getField(). getSourceLocation();
90+ SourceLocation sourceLocation = handlerParameters.getSourceLocation();
9191 ExecutionPath path = handlerParameters.getPath();
9292
9393 ExceptionWhileDataFetching error = new ExceptionWhileDataFetching(path, exception, sourceLocation);
94- handlerParameters.getExecutionContext().addError(error);
95- log.warn(error.getMessage(), exception);
94+ logNotSafe.warn(error.getMessage(), exception);
95+
96+ return DataFetcherExceptionHandlerResult.newResult().error(error).build();
9697 }
9798 }
9899{{< / highlight >}}
You can’t perform that action at this time.
0 commit comments