From 8e1f12d65943439c7c63f5d2d9e84aa0eb3a9701 Mon Sep 17 00:00:00 2001 From: Gabriel Ittner Date: Fri, 27 May 2022 18:25:25 +0200 Subject: [PATCH] fix error message when no repo is found (#337) * fix error message when no repo is found * add username to other error messages --- .../kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt b/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt index 5787213e..cc6524c9 100644 --- a/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt +++ b/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt @@ -7,7 +7,7 @@ import retrofit2.converter.moshi.MoshiConverterFactory internal class Nexus( baseUrl: String, - username: String, + private val username: String, password: String, private val stagingRepository: String? ) { @@ -28,7 +28,7 @@ internal class Nexus( val profileRepositoriesResponse = service.getProfileRepositories().execute() if (!profileRepositoriesResponse.isSuccessful) { - throw IOException("Cannot get profileRepositories: ${profileRepositoriesResponse.errorBody()?.string()}") + throw IOException("Cannot get profileRepositories for account $username: ${profileRepositoriesResponse.errorBody()?.string()}") } return profileRepositoriesResponse.body()?.data @@ -38,7 +38,7 @@ internal class Nexus( val allRepositories = getProfileRepositories() ?: emptyList() if (allRepositories.isEmpty()) { - throw IllegalArgumentException("No staging repository prefixed with. Make sure you called \"./gradlew publish\".") + throw IllegalArgumentException("No staging repositories found in account $username. Make sure you called \"./gradlew publish\".") } val candidateRepositories = if (stagingRepository != null) { @@ -49,7 +49,7 @@ internal class Nexus( if (candidateRepositories.isEmpty()) { throw IllegalArgumentException( - "No matching staging repository found. You can can explicitly choose one by " + + "No matching staging repository found in account $username. You can can explicitly choose one by " + "passing it as an option like this \"./gradlew closeAndReleaseRepository --repository=comexample-123\". " + "Available repositories are: ${allRepositories.joinToString(separator = ", ") { it.repositoryId }}" ) @@ -57,7 +57,7 @@ internal class Nexus( if (candidateRepositories.size > 1) { throw IllegalArgumentException( - "More than 1 matching staging repository found. You can can explicitly choose " + + "More than 1 matching staging repository found in account $username. You can can explicitly choose " + "one by passing it as an option like this \"./gradlew closeAndReleaseRepository --repository comexample-123\". " + "Available repositories are: ${allRepositories.joinToString(separator = ", ") { it.repositoryId }}" )