Skip to content

Commit 8e1f12d

Browse files
fix error message when no repo is found (#337)
* fix error message when no repo is found * add username to other error messages
1 parent 6134aa0 commit 8e1f12d

File tree

1 file changed

+5
-5
lines changed
  • nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus

1 file changed

+5
-5
lines changed

nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import retrofit2.converter.moshi.MoshiConverterFactory
77

88
internal class Nexus(
99
baseUrl: String,
10-
username: String,
10+
private val username: String,
1111
password: String,
1212
private val stagingRepository: String?
1313
) {
@@ -28,7 +28,7 @@ internal class Nexus(
2828
val profileRepositoriesResponse = service.getProfileRepositories().execute()
2929

3030
if (!profileRepositoriesResponse.isSuccessful) {
31-
throw IOException("Cannot get profileRepositories: ${profileRepositoriesResponse.errorBody()?.string()}")
31+
throw IOException("Cannot get profileRepositories for account $username: ${profileRepositoriesResponse.errorBody()?.string()}")
3232
}
3333

3434
return profileRepositoriesResponse.body()?.data
@@ -38,7 +38,7 @@ internal class Nexus(
3838
val allRepositories = getProfileRepositories() ?: emptyList()
3939

4040
if (allRepositories.isEmpty()) {
41-
throw IllegalArgumentException("No staging repository prefixed with. Make sure you called \"./gradlew publish\".")
41+
throw IllegalArgumentException("No staging repositories found in account $username. Make sure you called \"./gradlew publish\".")
4242
}
4343

4444
val candidateRepositories = if (stagingRepository != null) {
@@ -49,15 +49,15 @@ internal class Nexus(
4949

5050
if (candidateRepositories.isEmpty()) {
5151
throw IllegalArgumentException(
52-
"No matching staging repository found. You can can explicitly choose one by " +
52+
"No matching staging repository found in account $username. You can can explicitly choose one by " +
5353
"passing it as an option like this \"./gradlew closeAndReleaseRepository --repository=comexample-123\". " +
5454
"Available repositories are: ${allRepositories.joinToString(separator = ", ") { it.repositoryId }}"
5555
)
5656
}
5757

5858
if (candidateRepositories.size > 1) {
5959
throw IllegalArgumentException(
60-
"More than 1 matching staging repository found. You can can explicitly choose " +
60+
"More than 1 matching staging repository found in account $username. You can can explicitly choose " +
6161
"one by passing it as an option like this \"./gradlew closeAndReleaseRepository --repository comexample-123\". " +
6262
"Available repositories are: ${allRepositories.joinToString(separator = ", ") { it.repositoryId }}"
6363
)

0 commit comments

Comments
 (0)