Created
November 16, 2017 05:10
-
-
Save kebbbnnn/cc98f79fad45956c06bb85c56c87e3fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.retryWhen(errors -> errors.flatMap(error -> { | |
// For IOExceptions, we retry | |
if (error instanceof RetrofitError) { | |
RetrofitError retrofitError = (RetrofitError) error; | |
Response response = retrofitError.getResponse(); | |
if (response.getStatus() == 504) { | |
return Observable.just(null); | |
} | |
} | |
// For anything else, don't retry | |
return Observable.error(error); | |
}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment