default boolean shouldRetry()

in sdk/core/azure-core-http/src/main/java/com/azure/android/core/http/policy/RetryStrategy.java [33:49]


    default boolean shouldRetry(HttpResponse response, Throwable error, int retryAttempts) {
        if (error != null) {
            return error instanceof IOException
                || error instanceof TimeoutException;
        } else {
            if (response != null) {
                final int code = response.getStatusCode();
                return (code == HttpURLConnection.HTTP_CLIENT_TIMEOUT
                    || code == 429 // to-many requests
                    || (code >= HttpURLConnection.HTTP_INTERNAL_ERROR
                    && code != HttpURLConnection.HTTP_NOT_IMPLEMENTED
                    && code != HttpURLConnection.HTTP_VERSION));
            } else {
                return true;
            }
        }
    }