-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2007 from MaciejG604/react-to-sonatype-response-c…
…odes React to some HTTP responses
- Loading branch information
Showing
4 changed files
with
145 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
modules/cli/src/main/scala/scala/cli/errors/InvalidSonatypePublishCredentials.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package scala.cli.errors | ||
|
||
import scala.build.errors.BuildException | ||
|
||
final class InvalidSonatypePublishCredentials(usernameIsAscii: Boolean, passwordIsAscii: Boolean) | ||
extends BuildException( | ||
if (usernameIsAscii && passwordIsAscii) | ||
"Username or password to the publish repository are incorrect" | ||
else | ||
s"Your Sonatype ${InvalidSonatypePublishCredentials.isUsernameOrPassword( | ||
usernameIsAscii, | ||
passwordIsAscii | ||
)} unsupported characters" | ||
) | ||
|
||
object InvalidSonatypePublishCredentials { | ||
def isUsernameOrPassword(usernameIsAscii: Boolean, passwordIsAscii: Boolean): String = | ||
if (!usernameIsAscii && !passwordIsAscii) | ||
"password and username contain" | ||
else if (!usernameIsAscii) | ||
"username contains" | ||
else | ||
"password contains" | ||
} |
8 changes: 8 additions & 0 deletions
8
modules/cli/src/main/scala/scala/cli/errors/WrongSonatypeServerError.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package scala.cli.errors | ||
|
||
import scala.build.errors.BuildException | ||
|
||
final class WrongSonatypeServerError(legacyChosen: Boolean) | ||
extends BuildException( | ||
s"Wrong Sonatype server, try ${if legacyChosen then "'central-s01'" else "'central'"}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters