Share via


ErrorRecord Class

Definition

Represents an error.

public ref class ErrorRecord : System::Runtime::Serialization::ISerializable
[System.Serializable]
public class ErrorRecord : System.Runtime.Serialization.ISerializable
public class ErrorRecord : System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type ErrorRecord = class
    interface ISerializable
type ErrorRecord = class
    interface ISerializable
Public Class ErrorRecord
Implements ISerializable
Inheritance
ErrorRecord
Derived
Attributes
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 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.

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(Exception, String, ErrorCategory, Object)

Creates an instance of ErrorRecord.

ErrorRecord(SerializationInfo, StreamingContext)

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

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()

Applies to