Class RuntimeErrorCatcher
java.lang.Object
org.skriptlang.skript.log.runtime.RuntimeErrorCatcher
- All Implemented Interfaces:
RuntimeErrorConsumer
A
RuntimeErrorConsumer
to be used in RuntimeErrorManager
to catch RuntimeError
s.
This should always be used with start()
and stop()
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClear all cachedRuntimeError
s.@UnmodifiableView List
<RuntimeError> Gets all the cachedRuntimeError
s.@Nullable RuntimeErrorFilter
void
printError
(RuntimeError error) Prints a single error with all its information.void
printFrameOutput
(Frame.FrameOutput output, Level level) Prints the output of a frame, including skipped errors, timeouts, and whatever other information required.start()
Starts thisRuntimeErrorCatcher
, removing allRuntimeErrorConsumer
s fromRuntimeErrorManager
and storing them instoredConsumers
.void
stop()
Stops thisRuntimeErrorCatcher
, removing fromRuntimeErrorManager
and restoring the previousRuntimeErrorConsumer
s fromstoredConsumers
.
-
Constructor Details
-
RuntimeErrorCatcher
public RuntimeErrorCatcher()
-
-
Method Details
-
getFilter
- Specified by:
getFilter
in interfaceRuntimeErrorConsumer
- Returns:
- The filter to use when checking if this consumer should print an error. Defaults to the standard
config-driven filter. If no filter should be used, return
RuntimeErrorFilter.NO_FILTER
. This value MUST be effectively final.
-
start
Starts thisRuntimeErrorCatcher
, removing allRuntimeErrorConsumer
s fromRuntimeErrorManager
and storing them instoredConsumers
. Makes thisRuntimeErrorCatcher
the onlyRuntimeErrorConsumer
inRuntimeErrorManager
to catchRuntimeError
s.- Returns:
- This
RuntimeErrorCatcher
-
stop
public void stop()Stops thisRuntimeErrorCatcher
, removing fromRuntimeErrorManager
and restoring the previousRuntimeErrorConsumer
s fromstoredConsumers
. Prints all cachedRuntimeError
s,cachedErrors
. -
getCachedErrors
Gets all the cachedRuntimeError
s. -
clearCachedErrors
Clear all cachedRuntimeError
s. -
printError
Description copied from interface:RuntimeErrorConsumer
Prints a single error with all its information.- Specified by:
printError
in interfaceRuntimeErrorConsumer
- Parameters:
error
- The error to print.
-
printFrameOutput
Description copied from interface:RuntimeErrorConsumer
Prints the output of a frame, including skipped errors, timeouts, and whatever other information required.- Specified by:
printFrameOutput
in interfaceRuntimeErrorConsumer
- Parameters:
output
- An output object containing unmodifiable views of the frame data.level
- The severity of this frame (error vs warning).
-