ErrorRecord ErrorRecord ErrorRecord ErrorRecord Constructors

Definition

Overloads

ErrorRecord(ErrorRecord, Exception) ErrorRecord(ErrorRecord, Exception) ErrorRecord(ErrorRecord, Exception)

Copy constructor, for use when a new wrapper exception wraps an exception which already has an ErrorRecord ErrorCategoryInfo and ErrorDetails are deep-copied, other fields are not.

ErrorRecord(SerializationInfo, StreamingContext) ErrorRecord(SerializationInfo, StreamingContext) ErrorRecord(SerializationInfo, StreamingContext) ErrorRecord(SerializationInfo, StreamingContext)

Initializes a new instance of the ErrorRecord class using data serialized via ISerializable

ErrorRecord(Exception, String, ErrorCategory, Object) ErrorRecord(Exception, String, ErrorCategory, Object) ErrorRecord(Exception, String, ErrorCategory, Object)

Creates an instance of ErrorRecord.

ErrorRecord(ErrorRecord, Exception) ErrorRecord(ErrorRecord, Exception) ErrorRecord(ErrorRecord, Exception)

Copy constructor, for use when a new wrapper exception wraps an exception which already has an ErrorRecord ErrorCategoryInfo and ErrorDetails are deep-copied, other fields are not.

public:
 ErrorRecord(System::Management::Automation::ErrorRecord ^ errorRecord, Exception ^ replaceParentContainsErrorRecordException);
public ErrorRecord (System.Management.Automation.ErrorRecord errorRecord, Exception replaceParentContainsErrorRecordException);
new System.Management.Automation.ErrorRecord : System.Management.Automation.ErrorRecord * Exception -> System.Management.Automation.ErrorRecord

Parameters

errorRecord
ErrorRecord ErrorRecord ErrorRecord ErrorRecord

wrapped ErrorRecord

replaceParentContainsErrorRecordException
Exception Exception Exception Exception

If the wrapped exception contains a ParentContainsErrorRecordException, the new ErrorRecord should have this exception as its Exception instead.

ErrorRecord(SerializationInfo, StreamingContext) ErrorRecord(SerializationInfo, StreamingContext) ErrorRecord(SerializationInfo, StreamingContext) ErrorRecord(SerializationInfo, StreamingContext)

Initializes a new instance of the ErrorRecord class using data serialized via ISerializable

protected:
 ErrorRecord(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected ErrorRecord (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Management.Automation.ErrorRecord : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.Automation.ErrorRecord
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

Remarks

ErrorRecord instances which are serialized using ISerializable will only be partially reconstructed.

ErrorRecord(Exception, String, ErrorCategory, Object) ErrorRecord(Exception, String, ErrorCategory, Object) ErrorRecord(Exception, String, ErrorCategory, Object)

Creates an instance of ErrorRecord.

public:
 ErrorRecord(Exception ^ exception, System::String ^ errorId, System::Management::Automation::ErrorCategory errorCategory, System::Object ^ targetObject);
public ErrorRecord (Exception exception, string errorId, System.Management.Automation.ErrorCategory errorCategory, object targetObject);
new System.Management.Automation.ErrorRecord : Exception * string * System.Management.Automation.ErrorCategory * obj -> System.Management.Automation.ErrorRecord

Parameters

exception
Exception Exception Exception Exception

This is an exception which describes the error. This argument may not be null, but it is not required that the exception have ever been thrown.

errorId
String String String String

This string will be used to construct the FullyQualifiedErrorId, which is a global identifier of the error condition. Pass a non-empty string which is specific to this error condition in this context.

errorCategory
ErrorCategory ErrorCategory ErrorCategory ErrorCategory

This is the ErrorCategory which best describes the error.

targetObject
Object Object Object Object

This is the object against which the cmdlet or provider was operating when the error occurred. This is optional.

Applies to