Struct ErrorHandlerState
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?)
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)
Parameters
ModeErrorHandlingModeThe activation's current error-handling policy.
HandlerTargetint?For GoTo: the resolved offset to branch to on an error. Unused otherwise.
ActiveErrorIVBRaisableErrorThe error a handler most recently caught, if any — cleared by a
Resumestatement.Resumewith no active error is MS-VBAL §5.4.4.2 error 20, "Resume without error".FaultStatementOffsetint?The offset of the instruction whose execution raised ActiveError — what a bare
Resumere-executes, and whatResume Nextcontinues past.
Fields
Disabled
The state every activation starts with: no handler active, no active error.
public static readonly ErrorHandlerState Disabled
Field Value
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
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?
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; }