You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/02/21 09:00:24 UTC
(camel) 02/02: CAMEL-21769: camel-core: ScheduledPollConsumer should not swallow java.lang.Error but make a fatalog log and rethrow so the user has visibility of the serious error in the logs.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.10.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit c2e8c44851d07339231aa5b05d8d59bc8ddc4439
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 21 09:59:02 2025 +0100
CAMEL-21769: camel-core: ScheduledPollConsumer should not swallow java.lang.Error but make a fatalog log and rethrow so the user has visibility of the serious error in the logs.
---
.../main/java/org/apache/camel/support/ScheduledPollConsumer.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
index 658f7896d25..b6b68e668b9 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
@@ -130,9 +130,12 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer
} else {
LOG.trace("Scheduled task completed on: {}", this.getEndpoint());
}
-
} catch (Error e) {
- // must catch Error, to ensure the task is re-scheduled
+ // need to log so there is visibility as otherwise the user may not see anything in logs
+ LOG.error("Fatal error occurred during running scheduled task on: {}, due: {}.",
+ this.getEndpoint(), e.getMessage(), e);
+ throw e;
+ } catch (Throwable e) {
LOG.error("Error occurred during running scheduled task on: {}, due: {}."
+ " This exception is ignored and the task will run again on next poll.",
this.getEndpoint(), e.getMessage(), e);