Table of Contents

Struct ErrorHandlerState

Namespace
RDCore.SDK.Runtime.Shared
Assembly
RDCore.SDK.dll

The hidden per-activation state that gives On Error/Resume meaning (MS-VBAL §5.4.4) — every activation carries exactly one of these (not one per block-opening instruction, the way With/Select/For hidden state is), since an On Error statement changes the activation's policy going forward, not a lexically-scoped value.

public readonly record struct ErrorHandlerState : IEquatable<ErrorHandlerState>
Implements
Inherited Members

Constructors

ErrorHandlerState(ErrorHandlingMode, int?, IVBRaisableError?, int?, int?)

The hidden per-activation state that gives On Error/Resume meaning (MS-VBAL §5.4.4) — every activation carries exactly one of these (not one per block-opening instruction, the way With/Select/For hidden state is), since an On Error statement changes the activation's policy going forward, not a lexically-scoped value.

public ErrorHandlerState(ErrorHandlingMode Mode, int? HandlerTarget, IVBRaisableError? ActiveError, int? FaultStatementOffset, int? HandlerEntry = null)

Parameters

Mode ErrorHandlingMode

The activation's current error-handling policy.

HandlerTarget int?

For GoTo: the resolved offset to branch to on an error. Unused otherwise.

ActiveError IVBRaisableError

The error a handler most recently caught, if any — cleared by a Resume statement. Resume with no active error is MS-VBAL §5.4.4.2 error 20, "Resume without error".

FaultStatementOffset int?

The offset of the instruction whose execution raised ActiveError — what a bare Resume re-executes, and what Resume Next continues past.

HandlerEntry int?

For an activation that is running the handler an On Error GoTo caught an error with: the offset of the handler, until a Resume ends it. Kept apart from HandlerTarget because catching resets the policy, and with it where the next error would go. null when no handler is running.

Fields

Disabled

The state every activation starts with: no handler active, no active error.

public static readonly ErrorHandlerState Disabled

Field Value

ErrorHandlerState

Properties

ActiveError

The error a handler most recently caught, if any — cleared by a Resume statement. Resume with no active error is MS-VBAL §5.4.4.2 error 20, "Resume without error".

public IVBRaisableError? ActiveError { get; init; }

Property Value

IVBRaisableError

FaultStatementOffset

The offset of the instruction whose execution raised ActiveError — what a bare Resume re-executes, and what Resume Next continues past.

public int? FaultStatementOffset { get; init; }

Property Value

int?

HandlerEntry

For an activation that is running the handler an On Error GoTo caught an error with: the offset of the handler, until a Resume ends it. Kept apart from HandlerTarget because catching resets the policy, and with it where the next error would go. null when no handler is running.

public int? HandlerEntry { get; init; }

Property Value

int?

HandlerTarget

For GoTo: the resolved offset to branch to on an error. Unused otherwise.

public int? HandlerTarget { get; init; }

Property Value

int?

Mode

The activation's current error-handling policy.

public ErrorHandlingMode Mode { get; init; }

Property Value

ErrorHandlingMode