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

installing package from a local source that doesn't exist throws a bogus message #1674

Closed
yishaigalatzer opened this issue Nov 2, 2015 · 12 comments
Assignees
Labels
Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:VS.Client Type:Bug
Milestone

Comments

@yishaigalatzer
Copy link

Run the following command from Power Shell, of course make sure the folder c:\temp\data does not exist on your machine

PM> install-package Rules -source c:\temp\data
install-package : Unable to find package 'Rules'
At line:1 char:1
+ install-package Rules -source c:\temp\data
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

The error says Unable to find package 'Rules' instead of cannot find the folder (or a mix of the two)

@yishaigalatzer yishaigalatzer added this to the 3.4 milestone Dec 10, 2015
@yishaigalatzer yishaigalatzer added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:Bug labels Dec 10, 2015
@yishaigalatzer yishaigalatzer modified the milestones: 3.4 Beta, 3.4 RTM Feb 25, 2016
@yishaigalatzer yishaigalatzer modified the milestones: 3.4 RTM, 3.4 RTM - Triage, 3.5 Beta Mar 11, 2016
@yishaigalatzer yishaigalatzer modified the milestones: 3.5 Beta, 3.5 RC Apr 8, 2016
@mishra14 mishra14 modified the milestones: 3.5 RTM, 3.6 Beta Jul 6, 2016
@mishra14
Copy link
Contributor

mishra14 commented Jul 8, 2016

@rohit21agrawal @yishaigalatzer @harikmenon @rrelyea

Please let me know if this looks fine?

Case 1 - invalid local path

PM> install-package Rules -source c:\temp\data
install-package : Unable to find package 'Rules' at source 'c:\temp\data'. Source not found.
At line:1 char:1
+ install-package Rules -source c:\temp\data
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:00.0579984

Case 2 - Invalid http path that does not contain the package

PM> install-package Rules -source http://example.com
install-package : An error occurred while retrieving package metadata for 'Rules' from source 'http://example.com'.
  The V2 feed at 'http://example.com/FindPackagesById()?id='Rules'' returned an unexpected status code '404 Not Found'.
At line:1 char:1
+ install-package Rules -source http://example.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Case 3 - Random String as path

PM> install-package Rules -source random-string
install-package : Unsupported type of source  'random-string'. Please provide an http or local source.
At line:1 char:1
+ install-package Rules -source random-string
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:00.0547044

@rohit21agrawal
Copy link
Contributor

a random string can be the name of a source in the nuget.config file

@mishra14
Copy link
Contributor

mishra14 commented Jul 8, 2016

Yes. As we discussed offline, I will be removing the check for that. Thanks!

@mishra14
Copy link
Contributor

mishra14 commented Jul 8, 2016

@yishaigalatzer @harikmenon @rrelyea

Please let me know if this looks fine?

I have edited them, based on feedback from @rohit21agrawal .

Case 1 - invalid local path

PM> install-package Rules -source c:\temp\data

install-package : Unable to find package 'Rules' at source 'c:\temp\data'. Source not found.
At line:1 char:1
+ install-package Rules -source c:\temp\data
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Case 2 - Valid http path that does not contain the package

PM> install-package Rules -source http://example.com
install-package : An error occurred while retrieving package metadata for 'Rules' from source 'http://example.com'.
  The V2 feed at 'http://example.com/FindPackagesById()?id='Rules'' returned an unexpected status code '404 Not Found'.
At line:1 char:1
+ install-package Rules -source http://example.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Case 3 - Random String as path

PM> install-package Rules -source nuget.random
install-package : Unsupported type of source  'nuget.random'. Please provide an http or local source.
At line:1 char:1
+ install-package Rules -source nuget.random
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Case 4 - Known source

PM> install-package Rules -source nuget.org
install-package : Unable to find package 'Rules'
At line:1 char:1
+ install-package Rules -source nuget.org
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

@harikmenon
Copy link

:shipit:

@rrelyea
Copy link
Contributor

rrelyea commented Jul 12, 2016

Case 2 seems confusing. Why do we talk about package metadata?

@alpaix
Copy link

alpaix commented Jul 14, 2016

When the implementation PR is pushed we need to add end-to-end tests for each of the cases.

@mishra14 mishra14 reopened this Jul 14, 2016
@mishra14
Copy link
Contributor

@harikmenon : Realized that we cant have different error message for a random string, since its treated as a local relative string ( like a local folder name!). So the case 3 would be updated to the following -

Update Case 3 -

PM> install-package Rules -source nuget.random
install-package : Unable to find package 'Rules' at source 'nuget.random'. Source not found.
At line:1 char:1
+ install-package Rules -source nuget.random
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], PackageSourceException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Let me know your thoughts or if this is fine?

cc : @rohit21agrawal @rrelyea @yishaigalatzer

@harikmenon
Copy link

Sounds good to me.

@mishra14
Copy link
Contributor

@harikmenon : Had an offline talk with @rrelyea about the complexity of the error message in Case 2.

I will update that to the following, simpler error message -

Update Case 2 -

install-package : Unable to find package 'Rules' at source 'http://example.com'.
At line:1 char:1
+ install-package Rules -source http://example.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Let me know if this looks fine?

cc : @rohit21agrawal @yishaigalatzer

@harikmenon
Copy link

:shipit:

@mishra14
Copy link
Contributor

Original issue commits : NuGet/NuGet.Client@0f83bee NuGet/NuGet.Client@779f2bb

Improved Case 2 error message commit : NuGet/NuGet.Client@370687d

End to End test cases commit : NuGet/NuGet.Client@018ebd6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:VS.Client Type:Bug
Projects
None yet
Development

No branches or pull requests

6 participants