PowerShell / PowerShell/PSResourceGet
Provide more detailed error text when resource is not found
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
I saw the GA notice go out (good job getting to GA) and tried to update to the latest and accidently forgot to prefix the module name so it was not found. This produced a generic error message that the module was unable to be installed but in reality it failed due to it not existing.
Please update the failed install error text to say why it failed (module not found, etc).
Install-PSResource PSResourceGet -PassThru
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by running the Set-PSResourceRepository cmdlet. Are you sure you want to install the
PSResource from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
Install-PSResource: Package(s) 'PSResourceGet' could not be installed from repository 'PSGallery'.
Expected behavior
# Module not found error text instead of generic error message
Actual behavior
# Generic error message
Error details
Exception :
Type : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
Message : Package(s) 'PSResourceGet' could not be installed from repository 'PSGallery'.
HResult : -2146233088
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
CategoryInfo : InvalidData: (Microsoft.PowerShel…s.InstallPSResource:InstallPSResource) [Install-PSResource], ResourceNotFoundException
FullyQualifiedErrorId : InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
InvocationInfo :
MyCommand : Install-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 1
Line : Install-PSResource PSResourceGet -PassThru
Statement : Install-PSResource PSResourceGet -PassThru
PositionMessage : At line:1 char:1
+ Install-PSResource PSResourceGet -PassThru
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Install-PSResource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Environment data
1.0.0
7.4-preview6
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Install-PSResource PSResourceGet command and trace the InstallPSResource failure that produces ResourceNotFoundException and the InstallPackageFailure error ID. Update the reported text so a missing package is distinguished from a generic installation failure, then rerun the command to verify the message identifies the resource-not-found reason.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100