You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -701,7 +716,7 @@ private IEnumerable<PSResourceInfo> SearchByNames(ServerApiCall currentServer, R
701
716
_cmdletPassedIn.WriteDebug("No version specified, package name is '*'");
702
717
// Example: Find-PSResource -Name "*"
703
718
704
-
// Note: Just for resources from V2 servers, specifically PSGallery, if the resource is unlisted and was requested non-explicitly
719
+
// Note: Just for resources from V2 servers, specifically PSGallery, if the resource is unlisted and was requested non-explicitly
705
720
// (i.e requested name has wildcard) the resource should not be returned and ResponseUtil.ConvertToPSResourceResult() call needs to be informed of this.
706
721
// In all other cases, return the resource regardless of whether it was requested explicitly or not.
707
722
boolisResourceRequestedWithWildcard=isV2Resource;
@@ -752,7 +767,7 @@ private IEnumerable<PSResourceInfo> SearchByNames(ServerApiCall currentServer, R
_cmdletPassedIn.WriteDebug("No version specified, package name contains a wildcard.");
754
769
755
-
// Note: Just for resources from V2 servers, specifically PSGallery, if the resource is unlisted and was requested non-explicitly
770
+
// Note: Just for resources from V2 servers, specifically PSGallery, if the resource is unlisted and was requested non-explicitly
756
771
// (i.e requested name has wildcard) the resource should not be returned and ResponseUtil.ConvertToPSResourceResult() call needs to be informed of this.
757
772
// In all other cases, return the resource regardless of whether it was requested explicitly or not.
Copy file name to clipboardExpand all lines: src/code/Utils.cs
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1426,7 +1426,7 @@ public static bool ValidateModuleManifest(string moduleManifestPath, out string
1426
1426
returnfalse;
1427
1427
}
1428
1428
}
1429
-
1429
+
1430
1430
// Check for any errors from Test-ModuleManifest
1431
1431
if(pwsh.HadErrors)
1432
1432
{
@@ -1653,7 +1653,9 @@ public static void DeleteDirectoryWithRestore(string dirPath)
1653
1653
}
1654
1654
catch(Exceptione)
1655
1655
{
1656
-
throwe;
1656
+
thrownewPSInvalidOperationException(
1657
+
$"An error occurred while attempting to delete the directory at path {dirPath} with restore. Error: {e.Message}",
1658
+
e);
1657
1659
}
1658
1660
finally
1659
1661
{
@@ -1684,7 +1686,7 @@ public static void DeleteDirectory(string dirPath)
1684
1686
{
1685
1687
if(!Directory.Exists(dirPath))
1686
1688
{
1687
-
thrownewException($"Path '{dirPath}' that was attempting to be deleted does not exist.");
1689
+
thrownewPSInvalidOperationException($"Path '{dirPath}' that was attempting to be deleted does not exist.");
1688
1690
}
1689
1691
1690
1692
// Remove read only file attributes first
@@ -1721,10 +1723,10 @@ public static void DeleteDirectory(string dirPath)
1721
1723
if(ex.Message.Contains("The directory is not empty")&&psVersion.StartsWith("5"))
1722
1724
{
1723
1725
// there is a known bug with WindowsPowerShell and OneDrive based module paths, where .NET Directory.Delete() will throw a 'The directory is not empty.' error.
1724
-
thrownewException(string.Format("Cannot uninstall module with OneDrive based path on Windows PowerShell due to .NET issue. Try installing and uninstalling using PowerShell 7+ if using OneDrive."),ex);
1726
+
thrownewPSInvalidOperationException("Cannot uninstall module with OneDrive based path on Windows PowerShell due to .NET issue. Try installing and uninstalling using PowerShell 7+ if using OneDrive.",ex);
1725
1727
}
1726
1728
1727
-
thrownewException(string.Format("Access denied to path while deleting path {0}",dirPath),ex);
1729
+
thrownewPSInvalidOperationException(string.Format("Access denied to path while deleting path {0}",dirPath),ex);
0 commit comments