8000 Improve error message in FileSystemProvider by iSazonov · Pull Request #9551 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Improve error message in FileSystemProvider#9551

Merged
iSazonov merged 2 commits intoPowerShell:masterfrom
iSazonov:improve-error-message-fileprovider-1
May 8, 2019
Merged

Improve error message in FileSystemProvider#9551
iSazonov merged 2 commits intoPowerShell:masterfrom
iSazonov:improve-error-message-fileprovider-1

Conversation

@iSazonov
Copy link
Collaborator
@iSazonov iSazonov commented May 7, 2019

PR Summary

Improve the error message.

PR Context

Come from #9519 (comment)
Related code:

// First check if we can delete this file when force is not specified.
if (!Force &&
(fileSystemInfo.Attributes & (FileAttributes.Hidden | FileAttributes.System | FileAttributes.ReadOnly)) != 0)
{
string error = StringUtil.Format(FileSystemProviderStrings.PermissionError);
Exception e = new IOException(error);
ErrorDetails errorDetails =
new ErrorDetails(this, "FileSystemProviderStrings",
"CannotRemoveItem",
fileSystemInfo.FullName,
e.Message);
ErrorRecord errorRecord = new ErrorRecord(e, "RemoveFileSystemItemUnAuthorizedAccess", ErrorCategory.PermissionDenied, fileSystemInfo);
errorRecord.ErrorDetails = errorDetails;
WriteError(errorRecord);
return;

PR Checklist

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label May 7, 2019
@iSazonov iSazonov added this to the 7.0.0-preview.1 milestone May 7, 2019
@iSazonov iSazonov requested a review from SteveL-MSFT May 7, 2019 16:58
@iSazonov iSazonov self-assigned this May 7, 2019
…trings.resx

Co-Authored-By: iSazonov <darpa@yandex.ru>
@SteveL-MSFT
Copy link
Member

The change itself improves the current error message. I just wonder if we should tell the user to use -Force which will work if it's hidden, system, or read-only.

@iSazonov iSazonov merged commit 3947c9d into PowerShell:master May 8, 2019
@iSazonov iSazonov deleted the improve-error-message-fileprovider-1 branch May 8, 2019 03:25
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.

2 participants

0