Last Updated: February 25, 2016
·
1.228K
· rafaelcgo

How to compare Exceptions (Throwables) from getCause()

I was trying to see what kind of retrofitError was returning and compare it if it wasn't isNetworkError. Couldn't make it work comparing directly....

Example:
if (retrofitError.isNetworkError()) {
// Do something...
} else if (retrofitError.getCause().getClass().equals(ConversionException.class)) {
// Do something...
}