Table of Contents

Class VBRuntimeErrorInfo

Namespace
RDCore.SDK.Model.Errors
Assembly
RDCore.SDK.dll

Encapsulates the serializable error data for a runtime error.

public record VBRuntimeErrorInfo : VBErrorInfo, IEquatable<VBErrorInfo>, IVBRaisableError, IEquatable<VBRuntimeErrorInfo>
Inheritance
VBRuntimeErrorInfo
Implements
Inherited Members

Remarks

A runtime error occurs while traversing the abstract syntax tree (AST) in the RDCore runtime.

Fields

VBRuntimeErrors

The Classic-VB runtime error numbers and messages.

public static readonly Dictionary<VBRuntimeErrorId, string> VBRuntimeErrors

Field Value

Dictionary<VBRuntimeErrorId, string>

Remarks

👉 TODO localize to Exceptions.resx.

Properties

AsErrorInfo

This error as the diagnostic source metadata it is.

public VBErrorInfo AsErrorInfo { get; }

Property Value

VBErrorInfo

Remarks

Every raisable error is a VBErrorInfo — that is the constraint C# has no way to state on an interface, so it is stated here instead, and implemented as this. It is what lets a carrier hold the interface, keeping the diagnostic family with the error, and still hand the error to the diagnostics pipeline, which is generic over the record rather than over this.

Methods

For(VBRuntimeErrorId, SourceLocation, string)

Creates a new VBRuntimeErrorInfo describing the specified VBRuntimeErrorId at the specified SourceLocation.

public static VBRuntimeErrorInfo For(VBRuntimeErrorId vbCompileErrorId, SourceLocation location, string verbose)

Parameters

vbCompileErrorId VBRuntimeErrorId

The formal VBRuntimeErrorId value for this error.

location SourceLocation

The document location of the problematic node.

verbose string

A detailed message that is optionally appended, depending on the current server trace configuration.

Returns

VBRuntimeErrorInfo

A new instance of a VBRuntimeErrorInfo encapsulating the specified error metadata with a localized description string.

GetErrorString(VBRuntimeErrorId)

Gets the standard (localied) error message for the specified errorId.

public static string GetErrorString(VBRuntimeErrorId errorId)

Parameters

errorId VBRuntimeErrorId

The formal VBRuntimeErrorId value for this error.

Returns

string

ToDiagnosticCode()

The RD-VBAL §2.6.3 diagnostic code of this error, prefix and all.

public string ToDiagnosticCode()

Returns

string

Remarks

👉 A member rather than an extension, deliberately. An extension binds to the static type of what it is called on, so an application error held in a variable declared as anything more general would silently report the wrong family — which is exactly how an error travels through the interpreter.