mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Fix Get-Service non-terminating error message to include category (#20276)
et-Service cmdlet has a common method for emitting non-terminating error message. Unfortunately, it assumed that if there isn't an inner exception message to just leave the content blank when formatting the error string. Fix here is that if there isn't an inner exception message, we use the string value of the error category instead of an empty string.
This commit is contained in:
1 parent
8b1edaa496
commit
af1d99e321
1 file changed
+1
-1
@@ -103,7 +103,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
string message = StringUtil.Format(errorMessage,
|
||||
serviceName,
|
||||
displayName,
|
||||
(innerException == null) ? string.Empty : innerException.Message);
|
||||
(innerException == null) ? category.ToString() : innerException.Message);
|
||||
|
||||
var exception = new ServiceCommandException(message, innerException);
|
||||
exception.ServiceName = serviceName;
|
||||
|
||||
Reference in new issue
Block a user