★ wanayoo — archive 1999 https://github.com/PowerShell/PowerShell/pull/7823Nouvelle recherche | Portail wanayoo
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

Get/Add-Content throws improved error when targeting a container #7823

Merged
merged 4 commits into from Sep 28, 2018

Conversation

Projects
None yet
3 participants
@kvprasoon
Copy link
Contributor

commented Sep 19, 2018

PR Summary

Fix #7770
Fix #2686

Enhancing the error message as per #7770 and #2686

PR Checklist

@kvprasoon kvprasoon requested review from anmenaga and BrucePay as code owners Sep 19, 2018

@kvprasoon

This comment has been minimized.

Copy link
Contributor Author

commented Sep 20, 2018 •

@iSazonov I think more rules are added to CodeFactor, issues are in untouched lines.
Even CI failure is something different.

src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
// Throw error if path is a directory.
if (Directory.Exists(path))
{
string errMsg = StringUtil.Format(SessionStateStrings.GetContainerContentException, path);

This comment has been minimized.

Copy link
@iSazonov

iSazonov Sep 20, 2018

Collaborator

We need another message for "write" cmdlets.

This comment has been minimized.

Copy link
@kvprasoon

kvprasoon Sep 20, 2018

Author Contributor

Added different error message for Write to container exception.

src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
// Users can't both read as bytes, and specify a delimiter
if (delimiterSpecified)
{
{

This comment has been minimized.

Copy link
@iSazonov

iSazonov Sep 20, 2018

Collaborator

Please fix the line.

src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
@@ -6366,9 +6366,18 @@ public IContentReader GetContentReader(string path)

try
{
// Throw error if path is a directory.

This comment has been minimized.

Copy link
@iSazonov

iSazonov Sep 20, 2018

Collaborator

Please remove obvious comment.

src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
@@ -6514,6 +6523,15 @@ public IContentWriter GetContentWriter(string path)

try
{
// Throw error if path is a directory.

This comment has been minimized.

Copy link
@iSazonov

iSazonov Sep 20, 2018

Collaborator

Please remove obvious comment.

src/System.Management.Automation/resources/SessionStateStrings.resx Outdated
</data>
</data>
<data name="WriteContainerContentException" xml:space="preserve">
<value>Unable to access '{0}' contents as it is a directory.</value>

This comment has been minimized.

Copy link
@iSazonov

iSazonov Sep 21, 2018

Collaborator

I'd prefer {0} on end of the string because we support long paths.

Unable to write content because it is a directory: {0}

For GetContainerContentException too.
/cc @SteveL-MSFT

This comment has been minimized.

Copy link
@kvprasoon

kvprasoon Sep 21, 2018

Author Contributor

Sure, that makes sense.

This comment has been minimized.

Copy link
@SteveL-MSFT

SteveL-MSFT Sep 21, 2018

Member

I think the updated error messages are fine, even for GetContainerContentException.

@SteveL-MSFT

This comment has been minimized.

Copy link
Member

commented Sep 21, 2018

The package validation on NJsonSchema is a known issue not related to this PR

@SteveL-MSFT
Copy link
Member

left a comment

LGTM

@iSazonov

This comment has been minimized.

Copy link
Collaborator

commented Sep 23, 2018

Reopen the PR to restart all CIs.

@iSazonov iSazonov closed this Sep 23, 2018

@iSazonov iSazonov reopened this Sep 23, 2018

@SteveL-MSFT

This comment has been minimized.

Copy link
Member

commented Sep 24, 2018

@kvprasoon can you rebase off master to pick up test fixes?

@iSazonov iSazonov self-assigned this Sep 25, 2018

kvprasoon added some commits Sep 19, 2018

Get/Add-Content throws improved error when targeting a container
Get/Add-Content throws improved error when targeting a container
CodeFactor Fix
CodeFactor Fix
Review comments changes
Review comments changes
Error message changes as per review comments,
Error message changes as per review comments,
@iSazonov

This comment has been minimized.

Copy link
Collaborator

commented Sep 28, 2018

@kvprasoon I rebased for you.

Further please create new branch in your fork for every new change (don't put commits in forked master).

@kvprasoon

This comment has been minimized.

Copy link
Contributor Author

commented Sep 28, 2018 •

@iSazonov Sure, will do it, learning OSS collaboration from each PR... thanks

@iSazonov iSazonov merged commit e6702fe into PowerShell:master Sep 28, 2018

7 of 8 checks passed

CodeFactor 2 issues found.
Details
PowerShell-CI-linux #PR-7823-20180928.01 succeeded
Details
PowerShell-CI-macos #PR-7823-20180928.01 succeeded
Details
PowerShell-CI-spelling #PR-7823-20180928.01 succeeded
Details
PowerShell-CI-windows #PR-7823-20180928.01 succeeded
Details
WIP ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla All CLA requirements met.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.