I\'d like to handle situations when there is no internet connection. Usually I\'d run:
ConnectivityManager cm =
(ConnectivityManager)context.getSystemSer
just do this you will notified even for issues like
UnknownHostException
,
SocketTimeoutException
and others.
@Override public void onFailure(Call> call, Throwable t) {
if (t instanceof IOException) {
Toast.makeText(ErrorHandlingActivity.this, "this is an actual network failure :( inform the user and possibly retry", Toast.LENGTH_SHORT).show();
// logging probably not necessary
}
else {
Toast.makeText(ErrorHandlingActivity.this, "conversion issue! big problems :(", Toast.LENGTH_SHORT).show();
// todo log to some central bug tracking service
} }