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

John Yin commented on CAMEL-20770:
----------------------------------

Hi Claus,

Thanks for the response and explanation as always.  But for this one, I wish 
Camel has left it as it was in 3.18.x.  If the application developer does not 
want to catch Error's, .onException(Exception.class) can be used to achieve 
that.   In fact, allowing .onException(Throwable) to be used, but does not 
catch all Throwables is misleading.

As of now, .onException(Throwable) does not catch java.lang.AssertionError, the 
thread (in which the assertion is made) simply dies and the application carries 
on as if nothing has happened.

Thanks,

John

> onException(Throwable.class) does not catch java.lang.AssertionError
> --------------------------------------------------------------------
>
>                 Key: CAMEL-20770
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20770
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 4.4.0
>            Reporter: John Yin
>            Priority: Major
>
> The onException(Throwable.class) does not catch java.lang.AssertionError in 
> 4.4.0.  It worked fine in 3.18.x.
> Here is a sample:
> {code:java}
> from("timer://test?repeatCount=1")
>     .onException(Throwable.class).handled(true).log("in onException").end()
>     .process({
>         assert false : "test onException for assert"
>     }) {code}
> The onException would not catch the assert failure and not print "in 
> onException" in log.  The onException can catch other exceptions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to