Skip to content

Commit af7cff8

Browse files
committed
Added check for the error 429 in fetch with retry.
1 parent a24ec20 commit af7cff8

File tree

1 file changed

+6
-1
lines changed
  • src/main/java/com/github/underscore/lodash

1 file changed

+6
-1
lines changed

src/main/java/com/github/underscore/lodash/U.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2156,8 +2156,13 @@ && nonNull(timeBetweenRetry)
21562156
UnsupportedOperationException saveException;
21572157
do {
21582158
try {
2159-
return U.fetch(
2159+
final FetchResponse fetchResponse = U.fetch(
21602160
url, method, body, headerFields, connectTimeout, readTimeout);
2161+
if (fetchResponse.getStatus() == 429) {
2162+
saveException = new UnsupportedOperationException("Too Many Requests");
2163+
} else {
2164+
return fetchResponse;
2165+
}
21612166
} catch (UnsupportedOperationException ex) {
21622167
saveException = ex;
21632168
}

0 commit comments

Comments
 (0)