davsclaus opened a new pull request, #25786:
URL: https://github.com/apache/camel/pull/25786

   ## Summary
   
   - `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.
   
   ## Test plan
   
   - [x] `ErrorRegistryTest` (camel-core) - added 
`testErrorRegistryHandledErrorReportsOriginNode` (onException with further 
processing steps) and `testErrorRegistryDoCatchReportsOriginNode` (doCatch with 
further processing steps), both previously would have reported the handler's 
own node instead of the origin node.
   - [x] Full existing `ErrorRegistryTest` suite passes.
   - [x] Related suites verified: `*Try*Test`, `*Catch*Test`, `*Finally*Test`, 
`*OnException*Test`, `*DeadLetter*Test`, `*RedeliveryPolicy*Test`, 
`*ShareUnitOfWork*Test`, `*SplitParallel*Test`, `*MulticastParallel*Test`.
   - [x] Full reactor build (`mvn clean install -DskipTests`) passes, including 
regeneration of catalog/model doc artifacts.
   
   ---
   _Claude Code on behalf of Claus Ibsen_


-- 
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]

Reply via email to