例外が発生した場合にスロー可能な原因を取得して表示しようとしています:
if (throwable instanof MyException)
//Do something here..
} else if (throwable instanceof Exception) {
if (throwable.getCause() != null) {
//Show the cause here ..
// throwable.getCause().getLocalizedMessage()
}
}
式ウォッチャーがnullでない値を持っていることを示している間、私は常に使用時にnull
値を取得します。Cause
getCause()
原因を突き止めるには?