Error Record Interface
Implemented by exception classes which contain additional ErrorRecord information.
public interface class IContainsErrorRecord
public interface IContainsErrorRecord
type IContainsErrorRecord = interface
Public Interface IContainsErrorRecord
MSH defines certain exception classes which implement this interface. This includes wrapper exceptions such as CmdletInvocationException, and also MSH engine errors such as GetValueException. Cmdlets and providers should not define this interface; instead, they should use the WriteError(ErrorRecord) or ThrowTerminatingError(ErrorRecord) methods. The ErrorRecord property will contain an ErrorRecord which contains an instance of ParentContainsErrorRecordException rather than the actual exception.
Do not call WriteError(e.ErrorRecord). The ErrorRecord contained in the ErrorRecord property of an exception which implements IContainsErrorRecord should not be passed directly to WriteError, since it contains a ParentContainsErrorRecordException rather than the real exception.
It is permitted for PSSnapins to implement custom Exception classes which implement
but it is generally preferable for Cmdlets and CmdletProviders to communicate
rather than by throwing an exception which implements
This is the ErrorRecord which provides additional information about the error.