davsclaus opened a new pull request, #25813: URL: https://github.com/apache/camel/pull/25813
## Backport of #25786 Cherry-pick of #25786 onto `camel-4.22.x`. **Original PR:** #25786 - CAMEL-24513: camel-core - Error registry for handled exception should point to origin of error **Original author:** @davsclaus **Target branch:** `camel-4.22.x` ### Original description - `DefaultErrorRegistry` derived the failing node id/location from the *last* message history entry, which is only correct if nothing runs after the failure occurred. - For a **handled** exception, the exception handler itself (`onException`, `doCatch`, dead letter channel) can append its own message history entries before the registry captures the snapshot, so `toNode`/`location` ended up pointing at a node touched by the handler instead of the node that actually failed. Unhandled exceptions were already correct since nothing runs afterwards. - Adds `Exchange.FAILURE_NODE_ID` / `Exchange.FAILURE_LOCATION`, captured up-front via the new `ExchangeHelper.captureFailureOrigin()` as soon as the exception is caught (in `RedeliveryErrorHandler` and `TryProcessor`), before any failure processor runs. - `DefaultErrorRegistry` now reads this snapshot uniformly for both handled and unhandled errors, falling back to the previous last-message-history-entry heuristic only when no error handler captured it up-front (e.g. `noErrorHandler()`). - Documented the two new `Exchange` properties in `dead-letter-channel.adoc` (mirroring the existing "Which route/endpoint failed?" sections). Fixes CAMEL-24513. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
