Nebula
Loading...
Searching...
No Matches
Nebula.FaultReporter Class Reference

Detailed Description

The single place a plugin failure is reported.

A managed exception cannot cross the [UnmanagedCallersOnly] boundary. On Linux the runtime fails fast and the process goes with it, so everything the engine calls into the plugin has to be caught on this side, and this is where the report is made.

A property that throws keeps being called. The report says what failed and the rest of the frame runs. The same failure in every frame is the same failure, so a signature is reported the first time it is seen and then once every RepeatEvery times.

The counters are here for a test to read. The report itself goes to the engine's log, and this side has no way to read it back.

Static Public Member Functions

static void Report (string context, Exception exception)
 Reports a plugin exception from a guarded call.
static void Report (object owner, string operation, Exception exception)
 Reports a plugin exception from a guarded call on a plugin object.
static void ReportAssert (string expression, string file, int line, string member, string message, string stack)
 Reports a managed assertion that failed, with the call site the compiler put into the assembly.

Properties

static int ReportCount [get, private set]
static string LastContext [get, private set]
static string LastMessage [get, private set]

Static Private Member Functions

static bool ShouldReport (string signature)
 Whether this failure should be reported.

Static Private Attributes

static readonly Dictionary< string, int > seen = new Dictionary<string, int>()
const int RepeatEvery = 300

Member Function Documentation

◆ Report() [1/2]

void Nebula.FaultReporter.Report ( object owner,
string operation,
Exception exception )
inlinestatic

Reports a plugin exception from a guarded call on a plugin object.

The owner is what the report names, because a plugin's type is the thing a developer recognizes.

◆ Report() [2/2]

void Nebula.FaultReporter.Report ( string context,
Exception exception )
inlinestatic

Reports a plugin exception from a guarded call.

The context is the call site as this side knows it: the entry point, or the property's type and the method the guard ran.

◆ ReportAssert()

void Nebula.FaultReporter.ReportAssert ( string expression,
string file,
int line,
string member,
string message,
string stack )
inlinestatic

Reports a managed assertion that failed, with the call site the compiler put into the assembly.

◆ ShouldReport()

bool Nebula.FaultReporter.ShouldReport ( string signature)
inlinestaticprivate

Whether this failure should be reported.

The count is what makes a failure that happens every frame report once and then every RepeatEvery times.

Member Data Documentation

◆ RepeatEvery

const int Nebula.FaultReporter.RepeatEvery = 300
staticprivate

◆ seen

readonly Dictionary<string, int> Nebula.FaultReporter.seen = new Dictionary<string, int>()
staticprivate

Property Documentation

◆ LastContext

string Nebula.FaultReporter.LastContext
staticgetprivate set

◆ LastMessage

string Nebula.FaultReporter.LastMessage
staticgetprivate set

◆ ReportCount

int Nebula.FaultReporter.ReportCount
staticgetprivate set

The documentation for this class was generated from the following file: