From 1b1fb397352f2fc2d2822fdf916c1acf1a750e8f Mon Sep 17 00:00:00 2001 From: BOUHOURS Antoine Date: Tue, 5 Dec 2023 14:17:47 +0100 Subject: [PATCH] Don't log the cancellation exception. Get a consistent implementation with respect to other calculation services. --- .../voltageinit/server/service/VoltageInitWorkerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gridsuite/voltageinit/server/service/VoltageInitWorkerService.java b/src/main/java/org/gridsuite/voltageinit/server/service/VoltageInitWorkerService.java index 91a507d..e6b0d9d 100644 --- a/src/main/java/org/gridsuite/voltageinit/server/service/VoltageInitWorkerService.java +++ b/src/main/java/org/gridsuite/voltageinit/server/service/VoltageInitWorkerService.java @@ -37,6 +37,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; +import static org.gridsuite.voltageinit.server.service.NotificationService.CANCEL_MESSAGE; import static org.gridsuite.voltageinit.server.service.NotificationService.FAIL_MESSAGE; /** @@ -141,6 +142,7 @@ private void cancelVoltageInitAsync(VoltageInitCancelContext cancelContext) { private void cleanVoltageInitResultsAndPublishCancel(UUID resultUuid, String receiver) { resultRepository.delete(resultUuid); notificationService.publishStop(resultUuid, receiver); + LOGGER.info(CANCEL_MESSAGE + " (resultUuid='{}')", resultUuid); } @Bean @@ -173,8 +175,8 @@ public Consumer> consumeRun() { } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Exception e) { - LOGGER.error(FAIL_MESSAGE, e); if (!(e instanceof CancellationException)) { + LOGGER.error(FAIL_MESSAGE, e); Map errorIndicators = new HashMap<>(); errorIndicators.put(ERROR, ERROR_DURING_VOLTAGE_PROFILE_INITIALISATION);