PowerShell supports two classes of errors: nonterminating errors
and terminating errors. It collects both types of errors in the list
represented by the
Most errors are nonterminating errors, in that they do not halt execution of the current cmdlet, script, function, or pipeline. When a command outputs an error (via PowerShell’s error-output facilities,) PowerShell writes that error to a stream called the error output stream.
You can output a nonterminating error using the
Write-Error cmdlet (or the
WriteError() API when writing a
automatic variable allows you to control how PowerShell handles
nonterminating errors. It supports the following values:
ErrorActionPreference automatic variable values
Do not display errors.
Treat nonterminating errors as terminating errors.
Display errors, but continue execution of the current cmdlet, script, function, or pipeline. This is the default.
Display a prompt that asks how PowerShell should treat this error.
Most cmdlets allow you to configure this explicitly by passing one of the above values to its ErrorAction parameter.
A terminating error halts execution of the current cmdlet, script, function, or pipeline. If a command (such as a cmdlet or .NET method call) generates a structured exception (for example, if you provide a method with parameters outside of their valid range), PowerShell ...