CmdletProvider.ThrowTerminatingError Method (ErrorRecord)


Updated: April 27, 2016

Applies To: Windows PowerShell

Sends an error record to Windows PowerShell when a terminating error occurs and the provider cannot continue.

Namespace:   System.Management.Automation.Provider
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

public void ThrowTerminatingError(
	ErrorRecord errorRecord


Type: System.Management.Automation.ErrorRecord

A ErrorRecord object that describes the error condition.

When a provider encounters a terminating error, call this method rather than simply throwing an exception. Calling this method allows the provider to attach additional error record information that describes the condition that caused the terminating error. When this method is called, the Windows PowerShell runtime catches the error record and then starts shutting down the pipeline.

This method should not be used when nonterminating errors occur where the provider can continue. For more information about sending error reports when nonterminating errors occur, see the WriteError method.

For more information about providers, see Windows PowerShell Providers [ps].

Return to top

Community Additions