Class RuntimeErrorManager
java.lang.Object
org.skriptlang.skript.log.runtime.RuntimeErrorManager
- All Implemented Interfaces:
Closeable,AutoCloseable
Handles passing runtime errors between producers and consumers via a frame collection system.
The manager should be treated as a singleton and accessed via
The manager should be treated as a singleton and accessed via
getInstance()
or Skript.getRuntimeErrorManager(). Changing the frame length or limits requires edits to the
SkriptConfig values and a call to refresh(). Reloading the config will automatically
call refresh().- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRuntimeErrorManager(long frameLength) Creates a new error manager, which also creates its own frames. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConsumer(RuntimeErrorConsumer consumer) Adds aRuntimeErrorConsumerthat will receive the emitted errors and frame output data.voidaddConsumers(RuntimeErrorConsumer... newConsumers) Adds multipleRuntimeErrorConsumers that will receive the emitted errors and frame output data.voidclose()voiderror(@NotNull RuntimeError error) Emits a warning or error depending on severity.Deprecated, for removal: This API element is subject to removal in a future version.static RuntimeErrorManagerPrefer usingSkript.getRuntimeErrorManager()instead.Deprecated, for removal: This API element is subject to removal in a future version.static voidrefresh()Refreshes the runtime error manager for Skript, pulling from the config values.Removes allRuntimeErrorConsumers that receive emitted errors and frame output data.booleanremoveConsumer(RuntimeErrorConsumer consumer) Removes aRuntimeErrorConsumerfrom the tracked list.
-
Constructor Details
-
RuntimeErrorManager
public RuntimeErrorManager(long frameLength) Creates a new error manager, which also creates its own frames.
Must be closed when no longer being used.- Parameters:
frameLength- The length of a frame in ticks.
-
-
Method Details
-
getInstance
Prefer usingSkript.getRuntimeErrorManager()instead.- Returns:
- The singleton instance of the runtime error manager.
-
refresh
public static void refresh()Refreshes the runtime error manager for Skript, pulling from the config values. Tracked consumers are maintained during refreshes. -
error
Emits a warning or error depending on severity.- Parameters:
error- The error to emit.
-
getErrorFrame
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- The frame containing emitted errors.
-
getWarningFrame
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- The frame containing emitted warnings.
-
addConsumer
Adds aRuntimeErrorConsumerthat will receive the emitted errors and frame output data. Consumers will be maintained when the manager is refreshed.- Parameters:
consumer- The consumer to add.
-
addConsumers
Adds multipleRuntimeErrorConsumers that will receive the emitted errors and frame output data. Consumers will be maintained when the manager is refreshed.- Parameters:
newConsumers- TheRuntimeErrorConsumers to add.
-
removeConsumer
Removes aRuntimeErrorConsumerfrom the tracked list.- Parameters:
consumer- The consumer to remove.- Returns:
trueIf theconsumerwas removed.
-
removeAllConsumers
Removes allRuntimeErrorConsumers that receive emitted errors and frame output data.- Returns:
- All
RuntimeErrorConsumers removed.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
RuntimeErrorFilter.getErrorFrame()