【发布时间】:2011-07-21 00:48:08
【问题描述】:
我已经声明了我的 CustomException 类。 当 onException() 捕获它时,它会转到我定义的处理器:
onException(classOf[CustomException]).process(doSmth)
到目前为止一切顺利。 我需要进入处理器以检查异常是否属于“CustomException”类型的问题
当我写的时候:
def 进程(交换:交换)= { val 异常:CustomException= exchange.getProperty(Exchange.EXCEPTION_CAUGHT, classOf[CustomException])
我得到了 null
但是当我写的时候:
def process(exchange: Exchange) = {
val exception: Exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, classOf[Exception])
我得到了我的异常对象
如何检查处理器中抛出了哪种类型的异常!
【问题讨论】:
标签: apache-camel