Skip to content

Error message enhancement for clear-content cmdlet when targeting a directory#8134

Merged
iSazonov merged 9 commits into
PowerShell:masterfrom
kvprasoon:master
Nov 1, 2018
Merged

Error message enhancement for clear-content cmdlet when targeting a directory#8134
iSazonov merged 9 commits into
PowerShell:masterfrom
kvprasoon:master

Conversation

@kvprasoon
Copy link
Copy Markdown
Contributor

@kvprasoon kvprasoon commented Oct 27, 2018

PR Summary

Error message enhancement for clear-content cmdlet when targeting a directory

PR Checklist

if (Directory.Exists(path))
{
throw PSTraceSource.NewNotSupportedException(SessionStateStrings.ClearDirectoryContent, path);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect non-terminating error.

/cc @mklement0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be non-terminating error.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the check should be in the FileSystemProvider in this function:

not in the engine.

if (Directory.Exists(path))
{
throw PSTraceSource.NewNotSupportedException(SessionStateStrings.ClearDirectoryContent, path);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be non-terminating error.

if (Directory.Exists(path))
{
throw PSTraceSource.NewNotSupportedException(SessionStateStrings.ClearDirectoryContent, path);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the check should be in the FileSystemProvider in this function:

not in the engine.

@kvprasoon kvprasoon requested a review from anmenaga as a code owner October 28, 2018 19:07
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
Comment thread src/System.Management.Automation/resources/SessionStateStrings.resx Outdated
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
Comment thread test/powershell/Modules/Microsoft.PowerShell.Management/Clear-Content.Tests.ps1 Outdated
Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution!

Copy link
Copy Markdown

@anmenaga anmenaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/System.Management.Automation/resources/SessionStateStrings.resx Outdated
@iSazonov iSazonov self-assigned this Oct 30, 2018
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs
@iSazonov
Copy link
Copy Markdown
Collaborator

@kvprasoon Please add empty commit with "[Feature]" in header to run full test set.

@iSazonov iSazonov merged commit f59353d into PowerShell:master Nov 1, 2018
@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants