Cmdlet.WriteError(ErrorRecord) Cmdlet.WriteError(ErrorRecord) Cmdlet.WriteError(ErrorRecord) Method

Definition

Internal variant: Writes the specified error to the error pipe.

public:
 void WriteError(System::Management::Automation::ErrorRecord ^ errorRecord);
public void WriteError (System.Management.Automation.ErrorRecord errorRecord);
member this.WriteError : System.Management.Automation.ErrorRecord -> unit
Parameters
errorRecord
ErrorRecord ErrorRecord ErrorRecord

error

Exceptions

The pipeline has already been terminated, or was terminated during the execution of this method. The Cmdlet should generally just allow PipelineStoppedException to percolate up to the caller of ProcessRecord etc.

Remarks

ThrowTerminatingError(ErrorRecord) terminates the command, where WriteError(ErrorRecord) allows the command to continue.

    If the pipeline is terminated due to ActionPreference.Stop
    or ActionPreference.Inquire, this method will throw
    <xref data-throw-if-not-resolved="true" uid="System.Management.Automation.PipelineStoppedException"></xref>,
    but the command failure will ultimately be
    <xref data-throw-if-not-resolved="true" uid="System.Management.Automation.ActionPreferenceStopException"></xref>,

Applies to