-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Change error message when using New-Item to create a symlink and the item exists #3703
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
Conversation
…item exists (#3700) Also changed the ErrorId to "SymLinkExists".
@@ -336,4 +336,7 @@ | |||
<data name="DriveMaxSizeError" xml:space="preserve"> | |||
<value>Maximum size for drive has been exceeded: {0}.</value> | |||
</data> | |||
<data name="ItemExists" xml:space="preserve"> | |||
<value>Item '{0}' already exists.</value> | |||
</data> | |||
</root> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add Newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -344,6 +344,9 @@ Describe "Hard link and symbolic link tests" -Tags "CI", "RequireAdminOnWindows" | |||
$link.LinkType | Should BeExactly "SymbolicLink" | |||
$link.Target | Should Be $nonFile | |||
} | |||
It "New-Item fails informatively when reversing Path and Target" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the title more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Added newline to end of resource file.
<data name="ItemExists" xml:space="preserve"> | ||
<value>Item '{0}' already exists.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use the pattern from tests - "Path {0} to symbolic link already exists." ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "The path {0} already exists."? That's similar to the error message when New-Item
attempts to create a file that already exists, substituting "path" for "file".
I think that "Path {0} to symbolic link..." suggests that the existing item is itself a symbolic link, which is not necessarily the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this context we should mention "symbolic link".
Maybe "Cannot create symbolic link because the path {0} already exists."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that one. Fixed.
I also changed the name of the new string, to be a bit more clear about its use.
LGTM. |
@iSazonov Thanks for the review! |
Sorry, something went wrong.
Fix #3700
Improves the error displayed when attempting to create a
SymbolicLink
and the item named in-Path
already exists.Also changed the ErrorId to "SymLinkExists" to better identify the error.