我试图让一个抛出的异常的情况下,以显示它的原因:显示异常的原因
if (throwable instanof MyException)
//Do something here..
} else if (throwable instanceof Exception) {
if (throwable.getCause() != null) {
//Show the cause here ..
// throwable.getCause().getLocalizedMessage()
}
}
我使用getCause()
而表达守望表演时总是为Cause
一个null
值它有一个非空值。
如何获得的原因是什么?
Try * throwable.getMessage()* – 2013-04-21 22:53:30