ErrorRecord ErrorRecord ErrorRecord Class


Represents an error.

public class ErrorRecord : System.Runtime.Serialization.ISerializable
type ErrorRecord = class
    interface ISerializable
Public Class ErrorRecord
Implements ISerializable


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 IContainsErrorRecord which gives them an ErrorRecord property containing this additional information. In this case, ErrorRecord.Exception will be an instance of ParentContainsErrorRecordException. rather than the actual exception, to avoid the mutual references.


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)

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.


CategoryInfo CategoryInfo CategoryInfo

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

ErrorDetails ErrorDetails ErrorDetails

Additional information about the error.

Exception Exception Exception

An Exception describing the error.

FullyQualifiedErrorId FullyQualifiedErrorId FullyQualifiedErrorId

String which uniquely identifies this error condition

InvocationInfo InvocationInfo InvocationInfo

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

PipelineIterationInfo PipelineIterationInfo PipelineIterationInfo

The status of the pipeline when this record was created.

ScriptStackTrace ScriptStackTrace ScriptStackTrace

The script stack trace for the error.

TargetObject TargetObject TargetObject

The object against which the error occurred.


GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

Deserializer for ISerializable

ToString() ToString() ToString()

As ToString()

Applies to