Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IContainsErrorRecord Interface

Provides a mechanism for adding an error record to an exception.

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

Dim instance As IContainsErrorRecord

public interface IContainsErrorRecord
public interface IContainsErrorRecord
public interface IContainsErrorRecord

Windows PowerShell defines certain exception classes that implement this interface. This includes wrapper exceptions such as System.Management.Automation.CmdletInvocationException and Windows PowerShell runtime exceptions such as System.Management.Automation.GetValueException.

This interface should be implemented only when the exception is thrown when there is no reference to an active cmdlet or provider.

This interface should not be implemented by cmdlets and providers. Instead, cmdlets and providers should call the following methods.

For cmdlets, call one of the following methods:

For providers, call one of the following methods.

Windows PowerShell snap-ins can implement custom exception classes that implement IContainsErrorRecord. However, it is generally preferable for cmdlets and providers to communicate error records using the methods listed previously, rather than the snap-in throwing an exception that implements IContainsErrorRecord.


Target Platforms

© 2015 Microsoft