Skip to content

Commit

Permalink
fix(downloader): Handle IOExceptions during a file existence ping
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Feb 19, 2024
1 parent 25c9790 commit 263b64d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions downloader/src/main/kotlin/Downloader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ class Downloader(private val config: DownloaderConfiguration) {
val url = VcsHost.fromUrl(pkg.vcsProcessed.url)?.toArchiveDownloadUrl(pkg.vcsProcessed)
?: throw DownloadException("Unhandled VCS URL ${pkg.vcsProcessed.url}.")

val response = okHttpClient.ping(url)
val response = runCatching { okHttpClient.ping(url) }

if (response.code != HttpURLConnection.HTTP_OK) {
if (response.getOrNull()?.code != HttpURLConnection.HTTP_OK) {
throw DownloadException("Cannot verify existence of ${pkg.vcsProcessed}.")
}

Expand Down

0 comments on commit 263b64d

Please sign in to comment.