mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[jps cache] Add HTTP status code at logging the root cause of failed download
GitOrigin-RevId: 788a96457df1aa1759ff9894c4e610c9c92b1df0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ef43e8f093
commit
5383ca921e
+13
-5
@@ -62,15 +62,23 @@ class JpsCachesDownloader {
|
||||
try {
|
||||
downloaded = downloadFile(description, existing, requestHeaders, indicator);
|
||||
} catch (IOException e) {
|
||||
if (e instanceof HttpRequests.HttpStatusException && ((HttpRequests.HttpStatusException)e).getStatusCode() == 404) {
|
||||
LOG.info("File not found to download " + description.getDownloadUrl());
|
||||
indicator.finished();
|
||||
return null;
|
||||
int httpStatusCode = -1;
|
||||
if (e instanceof HttpRequests.HttpStatusException) {
|
||||
httpStatusCode = ((HttpRequests.HttpStatusException)e).getStatusCode();
|
||||
if (httpStatusCode == 404) {
|
||||
LOG.info("File not found to download " + description.getDownloadUrl());
|
||||
indicator.finished();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// If max attempt count exceeded, rethrow exception further
|
||||
if (attempt != MAX_RETRY_COUNT) {
|
||||
LOG.info("Failed to download " + description.getDownloadUrl() + ". Attempt " + attempt + " to download file again");
|
||||
if (httpStatusCode != -1) {
|
||||
LOG.info("Failed to download " + description.getDownloadUrl() + " HTTP code: " + httpStatusCode + ". Attempt " + attempt + " to download file again");
|
||||
} else {
|
||||
LOG.info("Failed to download " + description.getDownloadUrl() + ". Attempt " + attempt + " to download file again");
|
||||
}
|
||||
} else {
|
||||
throw new IOException(IdeBundle.message("error.file.download.failed", description.getDownloadUrl(), e.getMessage()), e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user