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...
}
Written by Rafael Oliveira
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Java
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#