Claus Ibsen created CAMEL-27765:
-----------------------------------

             Summary: camel-core - an exception in doTry that no doCatch 
matches is never logged by the error handler
                 Key: CAMEL-27765
                 URL: https://issues.apache.org/jira/browse/CAMEL-27765
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.25.0


An exception inside a {{doTry}} that no {{doCatch}} matches is never logged by 
the error handler. Outside a {{doTry}}, the same exception is logged as ERROR 
("Failed delivery for ..." with the message history). Inside, the error handler 
is quiet, and what the user sees depends on the consumer.

With a timer, the consumer logs a WARN with the exception. With a file 
consumer, the only line is the rollback, every poll, and the exception is not 
in the log at all:

{noformat}
WARN ... GenericFileOnCompletion : Rollback file strategy: 
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@7dbd938b
 for file: GenericFile[a.txt]
{noformat}

So a user who adds a {{doTry}} with a {{doCatch}} for one exception gets less 
logging for all other exceptions than with no {{doTry}} at all. This cost time 
when building the route/cache example in camel-jbang-examples: a typo in the 
route made the file consumer roll back each order, and nothing said why.

Reproduce with Camel 4.23.0 and {{camel run}}, with a file {{a.txt}} in {{in/}}:

{code:yaml}
- route:
    id: file-try
    from:
      uri: file:in
      parameters:
        noop: true
      steps:
        - doTry:
            steps:
              - throwException:
                  exceptionType: java.lang.IllegalStateException
                  message: boom inside doTry
            doCatch:
              - exception:
                  - java.io.IOException
                steps:
                  - log: caught io
{code}

Expected: the exception that leaves the {{doTry}} is logged as it would be 
without the {{doTry}}: the "Failed delivery" ERROR with the route, the node and 
the message history.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to