Class ProgramInvocationResult
How an invocation of one procedure of a program ended: the value the procedure returned, as JSON, or why it did not complete.
public sealed record ProgramInvocationResult : IEquatable<ProgramInvocationResult>
- Inheritance
-
ProgramInvocationResult
- Implements
- Inherited Members
Remarks
A run-time error of the program is a result (RuntimeError), never an exception. So is an argument that does not convert to its parameter's type: run-time error 13 (Type mismatch).
Properties
ErrorCode
The RD-VBAL §2.6.3 diagnostic code of the run-time error (VBR for one the runtime raised, VBA for one the program
raised); empty for any other outcome.
public string ErrorCode { get; init; }
Property Value
ErrorMessage
The description of the run-time error, as Err.Description reports it, or a short explanation of any other outcome that is not
Completed.
public string ErrorMessage { get; init; }
Property Value
ErrorNumber
The number of the run-time error, as Err.Number reports it, when Outcome is RuntimeError; 0
otherwise.
public int ErrorNumber { get; init; }
Property Value
ErrorVerbose
What the runtime says of the run-time error beyond its description (ErrorMessage), as plain text: such as the name a named argument gives that no parameter has, or the argument that is not of its parameter's type. null when it says no more, and for any other outcome. A host shows it as a client shows ErrorVerbose, under the description.
public string? ErrorVerbose { get; init; }
Property Value
HasValue
Whether the procedure returned a value: a Function or a Property Get that completed. A Sub returns none.
public bool HasValue { get; init; }
Property Value
Outcome
How the invocation ended.
public ExecutionOutcome Outcome { get; init; }
Property Value
Value
The value the procedure returned, as JSON: null, written as JSON null, for Empty, Null and Nothing,
and when HasValue is false.
public JsonNode? Value { get; init; }
Property Value
Methods
Completed()
A procedure that completed and returned no value: a Sub.
public static ProgramInvocationResult Completed()
Returns
- ProgramInvocationResult
A Completed result with no value.
Ended(ExecutionOutcome, string)
An invocation that ended otherwise, such as a procedure that was not found, a program that an End statement halted or that was interrupted,
or an invocation the machine refused.
public static ProgramInvocationResult Ended(ExecutionOutcome outcome, string explanation)
Parameters
outcomeExecutionOutcomeHow it ended: neither Completed nor RuntimeError.
explanationstringA short explanation of the outcome.
Returns
- ProgramInvocationResult
A result of that outcome.
Exceptions
- ArgumentOutOfRangeException
outcomeis Completed or RuntimeError, which Returned(JsonNode?), Completed() and RuntimeError(int, string, string) make.
Returned(JsonNode?)
A procedure that completed and returned a value.
public static ProgramInvocationResult Returned(JsonNode? value)
Parameters
Returns
- ProgramInvocationResult
A Completed result with a value.
RuntimeError(int, string, string)
A procedure that raised a run-time error that nothing handled.
public static ProgramInvocationResult RuntimeError(int number, string description, string code)
Parameters
numberintThe error's number, as
Err.Numberreports it.descriptionstringThe error's description, as
Err.Descriptionreports it.codestringThe error's RD-VBAL §2.6.3 diagnostic code.
Returns
- ProgramInvocationResult
A RuntimeError result.