ErrorRecord Class

Definition

Represents an error.

public class ErrorRecord : System.Runtime.Serialization.ISerializable
Inheritance
ErrorRecord
Derived
Implements

Remarks

An ErrorRecord describes an error. It extends the usual information in Exception with the additional information in ErrorDetails, TargetObject, CategoryInfo, FullyQualifiedErrorId, ErrorDetails, and InvocationInfo. Non-terminating errors are stored as ErrorRecord instances in shell variable $error.

        Some terminating errors implement
        <xref href="System.Management.Automation.IContainsErrorRecord"></xref>
        which gives them an ErrorRecord property containing this additional
        information.  In this case, ErrorRecord.Exception will be an instance of
        <xref href="System.Management.Automation.ParentContainsErrorRecordException"></xref>.
        rather than the actual exception, to avoid the mutual references.

Constructors

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)

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

ErrorRecord(Exception, String, ErrorCategory, Object)

Creates an instance of ErrorRecord.

Properties

CategoryInfo

Information regarding the ErrorCategory associated with this error, and with the categorized error message for that ErrorCategory.

ErrorDetails

Additional information about the error.

Exception

An Exception describing the error.

FullyQualifiedErrorId

String which uniquely identifies this error condition

InvocationInfo

Identifies the cmdlet, script, or other command which caused the error.

PipelineIterationInfo

The status of the pipeline when this record was created.

ScriptStackTrace

The script stack trace for the error.

TargetObject

The object against which the error occurred.

Methods

GetObjectData(SerializationInfo, StreamingContext)

Deserializer for ISerializable

ToString()

As ToString()