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

Expand logging around the exception that is thrown when Chocolatey CLI is unable to communicate with a source #3258

Closed
2 tasks done
gep13 opened this issue Jul 7, 2023 · 1 comment · Fixed by #3262
Closed
2 tasks done
Assignees
Milestone

Comments

@gep13
Copy link
Member

gep13 commented Jul 7, 2023

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.

There are times when Chocolatey CLI isn't able to communicate with a source. When this happens, the warning that is shown at the command line is typically the following:

Unable to load the service index for source https://community.chocolatey.org/api/v2/.

From what we have seen, the reason that this can happen range from:

  • attempting to run Chocolatey CLI on Windows 7/Windows Server 2008/R2
  • issues with proxy configuration
  • issues with VPN's
  • etc

We need to provide more information in the Chocolatey log file when this happens, so that we can attempt to point people in the right direction.

Describe The Solution. Why is it needed?

When the exception:

Unable to load the service index for source https://community.chocolatey.org/api/v2/.

Is thrown, there is typically a number of inner exceptions, that provide additional detail on the problem.

We need to enumerate through these exceptions, and record the message from each of them in the log file (NOTE: We aren't planning on emitting these to the CLI), so that we can instruct folks on how to resolve the problem.

In addition to capturing this output in the log file, we will also include a ch0.co short link to the documentation that is linked below, so that folks can try to figure out what is going in.

Additional Context

N/A

Related Issues

@gep13 gep13 added this to the 2.2.0 milestone Jul 7, 2023
@vexx32 vexx32 self-assigned this Jul 10, 2023
vexx32 added a commit to vexx32/choco that referenced this issue Jul 11, 2023
Previously all that was logged was the surface exception, which in quite
a few cases we've seen not yielding any useful information.

Instead, log the entire exception chain, surfacing just the outermost
and innermost exceptions, which we generally expect to contain the most
relevant information for users.
corbob pushed a commit to vexx32/choco that referenced this issue Jul 11, 2023
Previously all that was logged was the surface exception, which in quite
a few cases we've seen not yielding any useful information.

Instead, log the entire exception chain, surfacing just the outermost
and innermost exceptions, which we generally expect to contain the most
relevant information for users.
corbob pushed a commit to vexx32/choco that referenced this issue Jul 12, 2023
Previously all that was logged was the surface exception, which in quite
a few cases we've seen not yielding any useful information.

Instead, log the entire exception chain, surfacing just the outermost
and innermost exceptions, which we generally expect to contain the most
relevant information for users.
corbob added a commit that referenced this issue Jul 12, 2023
(#3258) Expand logging for nuget resources errors
@gep13 gep13 changed the title Expand logging around exception thrown when unable to communicate with source Expand logging around the exception that is thrown when Chocolatey CLI is unable to communicate with a source Jul 26, 2023
gep13 added a commit that referenced this issue Jul 26, 2023
* release/2.2.0: (21 commits)
  (doc) Update to indicate new package version used
  (maint) Add helper to split on max line lengths
  (#3281) Add validation for cache folder permissions
  (#3264) Update to latest Chocolatey.NuGet.Client
  (#3264) Ignore lock folders in cache directories
  (#3186) Remove easter egg
  (doc) Improve error message for defaultPushSource
  (tests) Clear HTTP Cache before getting packages
  (#3258) Expand logging for nuget resources errors
  (maint) Set file encoding to include BOM
  (#3237) Reduce number of queries for dependencies
  (#3231) Add tests to ensure package listing
  (maint) Remove unnecessary using statements
  (#3231) Don't refresh local package info during upgrade no-ops
  (build) Update to latest recipe package
  (doc) Minor corrections to wording
  (#3242) Add a script to run Authenticated tests
  (#3242) Attempt default credentials for sources
  (maint) Fix incorrect naming style uses
  (doc) Apply scripting best practices to output
  ...
@choco-bot
Copy link

🎉 This issue has been resolved in version 2.2.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants