If a cmdlet uses ThrowTerminatingError() then that ErrorRecord is not affected by the common -ErrorAction parameter. However, it is affected by $ErrorActionPreference. This inconsistency is not a regression from Windows PowerShell 5.1, but is a cause of lots of user confusion. Note that -ErrorAction Break DOES work because the code explicitly checks for that, but other values are not checked.
Steps to reproduce
Invoke-WebRequest https://foo.lskdjf -ErrorAction ignore
Expected behavior
Actual behavior
Environment data
Name Value
---- -----
PSVersion 7.2.0-preview.3
PSEdition Core
GitCommitId 7.2.0-preview.3
OS Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
If a cmdlet uses
ThrowTerminatingError()then that ErrorRecord is not affected by the common-ErrorActionparameter. However, it is affected by$ErrorActionPreference. This inconsistency is not a regression from Windows PowerShell 5.1, but is a cause of lots of user confusion. Note that-ErrorAction BreakDOES work because the code explicitly checks for that, but other values are not checked.Steps to reproduce
Expected behavior
Actual behavior
Environment data