Skip to content

Commit 4756506

Browse files
authored
Fix error formatting to remove the unneeded leading newline for concise view (PowerShell#19080)
1 parent b7e2913 commit 4756506

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,6 @@ function Get-ConciseViewPositionMessage {
12841284
return ""${errorColor}$($err.Exception.Message)${resetcolor}""
12851285
}
12861286
1287-
$myinv = $err.InvocationInfo
12881287
if ($ErrorView -eq 'DetailedView') {
12891288
$message = Get-Error | Out-String
12901289
return ""${errorColor}${message}${resetcolor}""
@@ -1301,10 +1300,9 @@ function Get-ConciseViewPositionMessage {
13011300
}
13021301
elseif ($myinv -and ($myinv.MyCommand -or ($err.CategoryInfo.Category -ne 'ParserError'))) {
13031302
$posmsg = $myinv.PositionMessage
1304-
}
1305-
1306-
if ($posmsg -ne '') {
1307-
$posmsg = $newline + $posmsg
1303+
if ($posmsg -ne '') {
1304+
$posmsg = $newline + $posmsg
1305+
}
13081306
}
13091307
13101308
if ($err.PSMessageDetails) {

0 commit comments

Comments
 (0)