-
Notifications
You must be signed in to change notification settings - Fork 0
API Host AuroraRuntimeException
Runtime exception with script-level stack trace information.
Namespace: AuroraScript. Kind: class.
Back to .NET Host API Reference
AuroraRuntimeException is raised when executing compiled script code fails. Beyond the usual CLR exception data, it exposes the failing module, the script line, and the script-level call stack as AuroraStackTrace frames, so a host can report an error in script terms instead of CLR terms.
Tip
Catch AuroraCompilationException for compile diagnostics and AuroraRuntimeException for script stack traces.
A minimal use of AuroraRuntimeException.
try
{
domain.Execute("MAIN", "run");
}
catch (AuroraRuntimeException ex)
{
Console.Error.WriteLine($"{ex.ModuleName}:{ex.LineNumber}");
}AuroraRuntimeException(Exception ex, IReadOnlyList<AuroraStackTrace> stackTrace)
AuroraRuntimeException(string message)
AuroraRuntimeException(ScriptError error)Creates a runtime exception from an underlying exception with script frames, a plain message, or a script ScriptError value.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ex |
Exception |
Yes | Underlying exception to wrap. Required by the first overload. |
stackTrace |
IReadOnlyList<AuroraStackTrace> |
Yes | Script stack frames captured at failure. Required by the first overload. |
message |
string |
Yes | Error description. Required by the second overload. |
error |
ScriptError |
Yes | Script error value. Required by the third overload. |
Returns
A new AuroraRuntimeException instance.
throw new AuroraRuntimeException("Script execution was rejected by the host.");string ModuleNameModule the failure was attributed to.
Parameters
None.
Returns
Returns string.
Console.Error.WriteLine(ex.ModuleName);int LineNumberScript line the failure was attributed to.
Parameters
None.
Returns
Returns int.
Console.Error.WriteLine($"{ex.ModuleName}:{ex.LineNumber}");IReadOnlyList<AuroraStackTrace> StackTraceScript-level call stack captured when the failure occurred.
Parameters
None.
Returns
Returns IReadOnlyList<AuroraStackTrace>.
Behavior
Frames are script frames, not CLR frames; use ToString() on each frame for a display line.
foreach (var frame in ex.StackTrace)
Console.Error.WriteLine(frame);string ToString()Formats the exception and its script stack trace as displayable text.
Parameters
None.
Returns
Returns string.
Console.Error.WriteLine(ex.ToString());AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License