mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix error formatting for pipeline enumeration exceptions (#20211)
This commit is contained in:
@@ -166,6 +166,15 @@ Describe 'Tests for $ErrorView' -Tag CI {
|
||||
start-job { [cmdletbinding()]param() $e = [System.Management.Automation.ErrorRecord]::new([System.Exception]::new('hello'), 1, 'ParserError', $null); $pscmdlet.ThrowTerminatingError($e) } | Wait-Job | Receive-Job -ErrorVariable e -ErrorAction SilentlyContinue
|
||||
$e | Out-String | Should -BeLike '*ParserError*'
|
||||
}
|
||||
|
||||
It 'Exception thrown from Enumerator.MoveNext in a pipeline shows information' {
|
||||
$e = {
|
||||
$l = [System.Collections.Generic.List[string]] @('one', 'two')
|
||||
$l | ForEach-Object { $null = $l.Remove($_) }
|
||||
} | Should -Throw -ErrorId 'BadEnumeration' -PassThru | Out-String
|
||||
|
||||
$e | Should -BeLike 'InvalidOperation:*'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'NormalView tests' {
|
||||
|
||||
Reference in New Issue
Block a user