Class VBRuntimeErrorInfo
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
Remarks
👉 TODO localize to Exceptions.resx.
Properties
AsErrorInfo
This error as the diagnostic source metadata it is.
public VBErrorInfo AsErrorInfo { get; }
Property Value
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
vbCompileErrorIdVBRuntimeErrorIdThe formal VBRuntimeErrorId value for this error.
locationSourceLocationThe document location of the problematic node.
verbosestringA 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
errorIdVBRuntimeErrorIdThe formal VBRuntimeErrorId value for this error.
Returns
ToDiagnosticCode()
The RD-VBAL §2.6.3 diagnostic code of this error, prefix and all.
public string ToDiagnosticCode()
Returns
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.