Skip to content

Commit

Permalink
Use display name in plugin download error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Sep 21, 2023
1 parent 7795d28 commit c0563d0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ internal abstract class PluginDownloadServiceImpl : PluginDownloadService {
connection.connect()

val status = connection.responseCode
val displayName = ctx.version.displayName ?: ctx.version.fileName
if (status == HttpURLConnection.HTTP_NOT_MODIFIED) {
// not modified
ctx.setter(ctx.version.copy(lastUpdateCheck = Instant.now().toEpochMilli()))
Expand All @@ -254,7 +255,6 @@ internal abstract class PluginDownloadServiceImpl : PluginDownloadService {
}

val opName = "${ctx.baseUrl}:${ctx.version.fileName}"
val displayName = ctx.version.displayName ?: ctx.version.fileName
val start = Instant.now()
LOGGER.lifecycle("Downloading {}...", displayName)
when (val res = Downloader(url, ctx.targetFile, displayName, opName).download(ctx.project, connection)) {
Expand All @@ -268,7 +268,7 @@ internal abstract class PluginDownloadServiceImpl : PluginDownloadService {
return ctx.targetFile
}

throw IllegalStateException("Failed to download ${ctx.version.fileName}, status code: $status")
throw IllegalStateException("Failed to download $displayName, status code: $status")
} finally {
connection.disconnect()
}
Expand Down

0 comments on commit c0563d0

Please sign in to comment.