Skip to content

Clean up error messages on proxy errors to make them more helpfulΒ #3757

@boernsen-development

Description

@boernsen-development

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

The output/error message when providing a wrong proxy address looks like this:

rdcman v3.1.0 (forced)
rdcman package files upgrade completed. Performing other installation steps.
Using explicit proxy server 'http://non-existing-proxy:9999'.
Attempt to get headers for https://download.sysinternals.com/files/RDCMan.zip failed.
  The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://download.sysinternals.com/files/RDCMan.zip'. Exception calling "GetResponse" with "0" argument(s): "Unable to connect to the remote server"
Downloading rdcman
  from 'https://download.sysinternals.com/files/RDCMan.zip'
Using explicit proxy server 'http://non-existing-proxy:9999'.
ERROR: The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://download.sysinternals.com/files/RDCMan.zip'. Exception calling "GetResponse" with "0" argument(s): "Unable to connect to the remote server"
The upgrade of rdcman was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\rdcman\tools\chocolateyInstall.ps1'.
 See log for details.

Chocolatey upgraded 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - rdcman (exited 404) - Error while running 'C:\ProgramData\chocolatey\lib\rdcman\tools\chocolateyInstall.ps1'.
 See log for details.

The output/error message when providing a correct proxy address, but with wrong credentials looks like this:

rdcman v3.1.0 (forced)
rdcman package files upgrade completed. Performing other installation steps.
Using explicit proxy server 'http://some-working-proxy:8080'.
Attempt to get headers for https://download.sysinternals.com/files/RDCMan.zip failed.
  The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://download.sysinternals.com/files/RDCMan.zip'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
Downloading rdcman
  from 'https://download.sysinternals.com/files/RDCMan.zip'
Using explicit proxy server 'http://some-working-proxy:8080'.
ERROR: The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://download.sysinternals.com/files/RDCMan.zip'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
The upgrade of rdcman was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\rdcman\tools\chocolateyInstall.ps1'.
 See log for details.

Chocolatey upgraded 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - rdcman (exited 404) - Error while running 'C:\ProgramData\chocolatey\lib\rdcman\tools\chocolateyInstall.ps1'.
 See log for details.

As one can see, they look very similar and the output generally seems polluted by a lot of irrelevant information. For me, it is hard to spot the relevant one, which I think only is

  • in the first case:
"Unable to connect to the remote server"
  • in the second case:
"The remote server returned an error: (407) Proxy Authentication Required."

Describe The Solution. Why is it needed?

It would be very helpful if

  • the actual error is printed without or with less additional information
  • the related config is printed (proxy, proxyUser or even the entire choco config), so that one can easily check its validity (apart from the encrypted password of course)
  • actions are proposed to solve the issue (e.g. choco config set proxy ... or choco config set proxyPassword ... etc.)
  • the entire output is formatted in an easily human-readable way

Ideally, errors would be returned as proper exception in PowerShell. I don't know whether this is possible though without loosing support for cmd.exe.

Especially when automated tasks run the command and the proxy's credentials change (regularly due to expiry), it is hard to analyze the cause quickly. We spend quiet some time puzzling over the cause and the solution (i.e. to just update the proxyPassword) every time this happened, which could be avoided.

Additional Context

Chocolatey v2.5.0

Command used:

choco upgrade rdcman --yes --force

Related Issues

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions