camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-564) Exchange.isFailed() doesn't work in camel 1.3
Date Wed, 04 Jun 2008 04:05:00 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43207#action_43207
] 

Claus Ibsen commented on CAMEL-564:
-----------------------------------

Hi Donatello

After digging into it a bit I see that Camel on purpose removes the traces of exception for
an exchange when you use the tryBlock().
See TryProcessor.java - method handleException

It's like giving a 2nd chance ;)

I do see a very valid reason for this as you with they tryBlock(). .. handle() takes care
of this any divert the route in the handle() block. The exchange has not failed yet, as it
could be a valid use-case.

Lets say you use an business API to update an inventory, and in the try block the business
API thrown a NoSuchInventoryException that you handle and do a a createInventory action instead.

Pseudo-code:
tryBlock()
  // update inventory
handle(NoSuchInventoryException)
  // create the inventory
end

So I do not think its a bug, but a feature.

However there is still a trace left of the original thrown exception:

On the exchange.in.header there is this propery still
caught.exception=java.lang.IllegalStateException: Force to fail

> Exchange.isFailed() doesn't work in camel 1.3
> ---------------------------------------------
>
>                 Key: CAMEL-564
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-564
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>            Reporter: Donatello Santoro
>            Assignee: Claus Ibsen
>         Attachments: TestException.java
>
>
> Writing
> this.from (address )
> .tryBlock ()                
> .process (new ProcessorFail() )                
> .to (xxxx )            
> .handle (Exception.class )                
> .process (new ProcessorAssertFail() )
> If the ProcessorFail raises an exception, comes recalled correctly the ProcessorAssertFail,
but if in his method process I write
> "Exchange failed? " + exchange.isFailed ()
> the result is FALSE. It's a bug? Using camel 1.2 with the same code the result is true

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message