]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18242 Clarify error message when creating new project without permissions durin...
authorEric Giffon <eric.giffon@sonarsource.com>
Tue, 7 Feb 2023 14:17:32 +0000 (15:17 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 8 Feb 2023 20:03:37 +0000 (20:03 +0000)
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DefaultScannerWsClientTest.java

index 3c5b422c77e76103d3220a14b201e038aec67244..a53e81dc4072e9a8db28a0e127ead33c3354a02e 100644 (file)
@@ -113,7 +113,8 @@ public class DefaultScannerWsClient implements ScannerWsClient {
         + "Please provide a user token in %s or other credentials in %s and %s.", CoreProperties.LOGIN, CoreProperties.LOGIN, CoreProperties.PASSWORD));
     }
     if (code == HTTP_FORBIDDEN) {
-      throw MessageException.of("You're not authorized to run analysis. Please contact the project administrator.");
+      throw MessageException.of("You're not authorized to analyze this project or the project doesn't exist on SonarQube" +
+        " and you're not authorized to create it. Please contact an administrator.");
     }
     if (code == HTTP_BAD_REQUEST) {
       String jsonMsg = tryParseAsJsonError(response.content());
index df4aaffb90d2264967684cb6ddd6bd0775c4193d..cf2c26e7a15bc4443fcc95090e030e1c590fe92c 100644 (file)
@@ -127,7 +127,7 @@ public class DefaultScannerWsClientTest {
     assertThatThrownBy(() -> new DefaultScannerWsClient(wsClient, true,
       new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap())), analysisWarnings).call(request))
         .isInstanceOf(MessageException.class)
-        .hasMessage("You're not authorized to run analysis. Please contact the project administrator.");
+        .hasMessage("You're not authorized to analyze this project or the project doesn't exist on SonarQube and you're not authorized to create it. Please contact an administrator.");
   }
 
   @Test