From 3d9df953d455e1b33e9fdd53bb692732a37b8a75 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Wed, 1 Jan 2025 18:44:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20improve=20log=20message=20of=20swal?= =?UTF-8?q?lowed=20exceptions=20=F0=9F=A6=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cffu/eh/ExHandleOfMultiplyCfsUtils.java | 6 +++++- .../cffu/internal/ExceptionLogger.java | 19 +++++++++++-------- scripts/integration_test | 8 ++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/cffu-core/src/main/java/io/foldright/cffu/eh/ExHandleOfMultiplyCfsUtils.java b/cffu-core/src/main/java/io/foldright/cffu/eh/ExHandleOfMultiplyCfsUtils.java index 28274cce..82e0f4b7 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/eh/ExHandleOfMultiplyCfsUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/eh/ExHandleOfMultiplyCfsUtils.java @@ -9,6 +9,7 @@ import java.util.concurrent.CompletionStage; import static io.foldright.cffu.CompletableFutureUtils.unwrapCfException; +import static io.foldright.cffu.internal.ExceptionLogger.logException; import static io.foldright.cffu.internal.ExceptionLogger.logUncaughtException; @@ -79,7 +80,10 @@ public static ExceptionHandler cffuExHandler() { return CFFU_EX_HANDLER; } - private static final ExceptionHandler CFFU_EX_HANDLER = exInfo -> logUncaughtException(exInfo.where, exInfo.ex); + private static final ExceptionHandler CFFU_EX_HANDLER = exInfo -> { + String msg = "Swallowed exception of cf" + (exInfo.index + 1) + " at " + exInfo.where; + logException(msg, exInfo.ex); + }; /** * Creates new CompletionStages that only capture exception results from the input CompletionStages, diff --git a/cffu-core/src/main/java/io/foldright/cffu/internal/ExceptionLogger.java b/cffu-core/src/main/java/io/foldright/cffu/internal/ExceptionLogger.java index 543f4069..691b4a98 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/internal/ExceptionLogger.java +++ b/cffu-core/src/main/java/io/foldright/cffu/internal/ExceptionLogger.java @@ -9,7 +9,7 @@ * Internal exception logging utility for the cffu library. *

* By default, uncaught exceptions are logged with their complete stack traces. The logging behavior can be configured - * through the system property {@code cffu.uncaught.exception.log.format} with the following values: + * through the system property {@code cffu.exception.log.format} with the following values: *