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

Detect empty V2 server responses at ServerApiCall level instead of ResponseUtil level #1358

Merged

Conversation

anamnavi
Copy link
Member

@anamnavi anamnavi commented Aug 11, 2023

Previously for scenarios where a package could not be found on the server, V2ServerApiCall responses returned were non-empty XML responses, so an error indicating package not found was not detected and errRecord was not populated. This meant that at the ResponseUtil level the response would try to be converted to a PSResourceInfo and throw an error and we would catch and error handle in FindHelper for the "Package not found" scenario.

This PR changes that. The parameter $inlinecount=allpages is added to the V2 request so that count is always returned in the response. This is used to detect a "Package not found" scenario and then an errRecord with FullyQualifiedErrorId "PackageNotFound" is returned and detected in FindHelper to properly error write or write verbose.

Changes were also made to the other ServerApiCalls classes to consistently return errRecords with FullyQualifiedErrorId "PackageNotFound" when a package isn't found.

PR Summary

PR Context

Resolves #1349

PR Checklist

@SydneyhSmith SydneyhSmith added PR-Bug This pull request resolves an issue bug Release This pull request is part the next release labels Aug 14, 2023
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
src/code/V2ServerAPICalls.cs Outdated Show resolved Hide resolved
anamnavi and others added 10 commits August 14, 2023 16:08
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
…to fix-v2server-emptyresponses-errorhandling
@anamnavi anamnavi merged commit f1bd599 into PowerShell:master Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bug This pull request resolves an issue bug Release This pull request is part the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

For V2Server (PSGallery) Package Not Found should be detected at ServerApiCall level
3 participants