Skip to content

API Host AuroraRuntimeException

Liu.Yandong.Hanks edited this page Aug 21, 2026 · 3 revisions

AuroraRuntimeException

Runtime exception with script-level stack trace information.

Namespace: AuroraScript. Kind: class.

Back to .NET Host API Reference

Overview

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.

Quick Reference

A minimal use of AuroraRuntimeException.

try
{
    domain.Execute("MAIN", "run");
}
catch (AuroraRuntimeException ex)
{
    Console.Error.WriteLine($"{ex.ModuleName}:{ex.LineNumber}");
}

Constructors

AuroraRuntimeException

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.");

Fields

ModuleName

string ModuleName

Module the failure was attributed to.

Parameters

None.

Returns

Returns string.

Console.Error.WriteLine(ex.ModuleName);

LineNumber

int LineNumber

Script line the failure was attributed to.

Parameters

None.

Returns

Returns int.

Console.Error.WriteLine($"{ex.ModuleName}:{ex.LineNumber}");

StackTrace

IReadOnlyList<AuroraStackTrace> StackTrace

Script-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);

Methods

ToString

string ToString()

Formats the exception and its script stack trace as displayable text.

Parameters

None.

Returns

Returns string.

Console.Error.WriteLine(ex.ToString());

Clone this wiki locally