public class ErrorUtil implements ErrorHandler { public ErrorUtil() { } public Throwable handleError(RetrofitError cause) { String errorDescription = null; Log.e("NON FATAL ERROR: ", cause.getLocalizedMessage()); if (cause.getKind().equals(RetrofitError.Kind.NETWORK)) { if (!isNetworkAvailable()) { errorDescription = ErrorConstants.ERROR_CONNECTION_OFFLINE; } else if (cause.getMessage().contains("Unable to resolve host") || cause.getMessage().contains("Invalid sequence") || cause.getMessage().contains("Illegal character") || cause.getMessage().contains("was not verified")) { errorDescription = ErrorConstants.ERROR_UNABLE_TO_RESOLVE_HOST; } else if (cause.getLocalizedMessage().contains("timeout") || cause.getLocalizedMessage().contains("timed out") || cause.getLocalizedMessage().contains("failed to connect")) { errorDescription = ErrorConstants.ERROR_CONNECTION_TIMEOUT; } else if (cause.getLocalizedMessage().equals("Connection closed by peer") || cause.getLocalizedMessage().equals("host == null") || cause.getLocalizedMessage().contains("CertPathValidatorException")) { errorDescription = ErrorConstants.ERROR_UNABLE_TO_RESOLVE_HOST; } else { errorDescription = ErrorConstants.ERROR_NETWORK; } } else if (cause.getKind().equals(RetrofitError.Kind.CONVERSION)) { errorDescription = ErrorConstants.ERROR_JSON_RESPONSE_CONVERSION; } else if (cause.getResponse() == null) { errorDescription = ErrorConstants.ERROR_NO_RESPONSE; } else { errorDescription = ErrorConstants.ERROR_UNKNOWN; } Log.d("ERRORUTILReturn", errorDescription); return new Exception(errorDescription); }
Log.d(TAG, "login: " + e.getClass() + ": " + e.getLocalizedMessage()); try { HatchetAuthResponse authResponse = (HatchetAuthResponse)
"register: " + e.getClass() + ": " + e.getLocalizedMessage()); try { HatchetAuthResponse authResponse = (HatchetAuthResponse)
Log.e(TAG, "fetchAccessToken: " + e.getClass() + ": " + e.getLocalizedMessage()); try { HatchetAuthResponse authResponse = (HatchetAuthResponse)
} catch (RetrofitError e) { Log.e(TAG, "send: Request to " + e.getUrl() + " failed: " + e.getClass() + ": " + e.getLocalizedMessage()); if (e.getResponse() != null && e.getResponse().getStatus() == 500) { Log.e(TAG, "send: discarding oplog that has failed to be sent to " + e
+ ": " + e.getLocalizedMessage());