Skip to content

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

Merged
Ilya (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
Ilya (iSazonov) merged 9 commits into
PowerShell:masterfrom
kvprasoon:master

Conversation

@kvprasoon

@kvprasoon PRASOON KARUNAN V (kvprasoon) commented Oct 27, 2018

Copy link
Copy Markdown
Contributor

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 Michael Klement (@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.

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

@SteveL-MSFT Steve Lee (SteveL-MSFT) left a comment

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.

LGTM. Thanks for the contribution!

@anmenaga Andrew (anmenaga) left a comment

Copy link
Copy Markdown

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 Ilya (iSazonov) self-assigned this Oct 30, 2018
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs
@iSazonov

Copy link
Copy Markdown
Collaborator

PRASOON KARUNAN V (@kvprasoon) Please add empty commit with "[Feature]" in header to run full test set.

@iSazonov
Ilya (iSazonov) merged commit f59353d into PowerShell:master Nov 1, 2018
@iSazonov Ilya (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
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
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