Table of Contents

Class TimbnSafe

Namespace
Timbn.GraveyardKeeperTwo.Core.Framework
Assembly
Timbn.GraveyardKeeperTwo.Core.dll

Runs a handler and logs a throw instead of letting it reach the game, in one wording for all of Core and the mods. Use it around any code a game event or a callback runs, since a throw that reaches the game can drop the handler for the rest of the session or stop a frame half done.

public static class TimbnSafe
Inheritance
TimbnSafe
Inherited Members

Methods

Run(Action?, ManualLogSource, string)

Runs the code and logs a throw as an error naming what threw.

public static bool Run(Action? action, ManualLogSource logger, string what)

Parameters

action Action

The code to run. Null counts as having run.

logger ManualLogSource

The plugin's Logger, so the line shows under the plugin's name.

what string

What the code is, for the log line, such as a class and what it was doing.

Returns

bool

True when the code ran through, false when it threw.

Examples

TimbnSafe.Run(LoadPacks, Logger, $"{nameof(QuestPacks)}|Loading the quest packs");