Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide more user friendly error when SQ is down or not running #1149

Closed
pavel-mikula-sonarsource opened this issue Jan 21, 2022 · 1 comment · Fixed by #1539 or #1549
Closed

Provide more user friendly error when SQ is down or not running #1149

pavel-mikula-sonarsource opened this issue Jan 21, 2022 · 1 comment · Fixed by #1539 or #1549

Comments

@pavel-mikula-sonarsource
Copy link
Contributor

When SQ is not running or cannot be contacted a message with a long call stack is displayed.

We should display user-friendly message about not being able to contact the server and suggesting to check that server is running and address is correct.

Followed by the original message. Without the full stack trace.

Similar message appears when there's a typo in /d:sonar.host.url="https://localhost:9000" - wrong protocol

SonarScanner for MSBuild 5.3.1
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
16:52:15.01  Updating build integration targets...
16:52:19.143  Failed to request and parse 'http://localhost:9000/api/server/version': An error occurred while sending the request.

Unhandled Exception: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:9000
   at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<Download>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass18_0.<<DownloadServerVersion>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<DoLogExceptions>d__17`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<DownloadServerVersion>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<GetServerVersion>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<WarnIfSonarQubeVersionIsDeprecated>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.<DoExecute>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.<Execute>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.BootstrapperClass.<PreProcess>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.BootstrapperClass.<Execute>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Execute>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Execute>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Main>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Main>(String[] args)
@duncanp-sonar duncanp-sonar added this to To do in Proposed hardening tickets via automation Apr 7, 2022
@andrei-epure-sonarsource andrei-epure-sonarsource changed the title Provide more user friendly when SQ is down or not running Provide more user friendly error when SQ is down or not running May 25, 2022
@andrei-epure-sonarsource andrei-epure-sonarsource added this to the 5.7.0 milestone May 30, 2022
@andrei-epure-sonarsource
Copy link
Contributor

andrei-epure-sonarsource commented May 30, 2022

Also should provide the error details when gets an error code 400

Currently:

SonarScanner for MSBuild 5.6
Using the .NET Core version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
13:38:34.048  Updating build integration targets...
13:38:34.869  Fetching analysis configuration settings...
13:38:35.424  Failed to request and parse 'https://sonarcloud.io/api/qualityprofiles/search?project=2022-05-30-test-netcore21-warning': Response status code does not indicate success: 400 ().

Unhandled Exception: System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 ().

And in the browser, by using the link in the error message:
image

Having this error directly in the cmline can improve user experience.

@andrei-epure-sonarsource andrei-epure-sonarsource removed this from the 5.7.0 milestone Jun 16, 2022
@costin-zaharia-sonarsource costin-zaharia-sonarsource added this to the 5.13.0 milestone Mar 15, 2023
@github-actions github-actions bot added this to To do in S4NET Kanban Mar 15, 2023
@costin-zaharia-sonarsource costin-zaharia-sonarsource moved this from To do to In progress in S4NET Kanban Mar 23, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in S4NET Kanban Mar 27, 2023
@github-actions github-actions bot moved this from Review in progress to In progress in S4NET Kanban Mar 27, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in S4NET Kanban Mar 28, 2023
@github-actions github-actions bot moved this from Review in progress to Reviewer approved in S4NET Kanban Mar 28, 2023
S4NET Kanban automation moved this from Reviewer approved to Done Mar 28, 2023
@costin-zaharia-sonarsource costin-zaharia-sonarsource moved this from Done to In progress in S4NET Kanban Mar 28, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in S4NET Kanban Mar 30, 2023
@github-actions github-actions bot moved this from Review in progress to In progress in S4NET Kanban Mar 30, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in S4NET Kanban Mar 30, 2023
@github-actions github-actions bot moved this from Review in progress to Reviewer approved in S4NET Kanban Mar 31, 2023
S4NET Kanban automation moved this from Reviewer approved to Done Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment