Interface RuntimeErrorProducer
- All Known Subinterfaces:
SyntaxRuntimeErrorProducer
- All Known Implementing Classes:
ExprDisplayBillboard
,ExprDisplayGlowOverride
,ExprDisplayHeightWidth
,ExprDisplayInterpolation
,ExprDisplayShadow
,ExprDisplayTeleportDuration
,ExprDisplayTransformationRotation
,ExprDisplayTransformationScaleTranslation
,ExprDisplayViewRange
,ExprItemDisplayTransform
,ExprItemOfEntity
,ExprLootContextEntity
,ExprLootContextLocation
,ExprLootContextLooter
,ExprLootContextLuck
,ExprLootTable
,ExprLootTableSeed
,ExprLoveTime
,ExprQuaternionAxisAngle
,ExprTagKey
,ExprTextDisplayAlignment
,ExprTextDisplayLineWidth
,ExprTextDisplayOpacity
,ExprTextOf
,ch.njol.skript.expressions.base.SimplePropertyExpression
public interface RuntimeErrorProducer
A RuntimeErrorProducer can throw runtime errors in a standardized and controlled manner.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Dispatches a runtime error with the given text.@NotNull ErrorSource
Gets the source of the errors produced by the implementing class.default RuntimeErrorManager
@Nullable String
Gets the text that should be underlined within the line contents.default void
Dispatches a runtime warning with the given text.
-
Method Details
-
getErrorSource
Gets the source of the errors produced by the implementing class. Most extending interfaces should provide a default implementation of this method for ease of use.- Returns:
- The source of the error.
- See Also:
-
toHighlight
Gets the text that should be underlined within the line contents. This should match the text the user wrote that was parsed as the syntax that threw the runtime issue. For example, if the skull expression ingive skull of player to all players
throws a runtime error, this method should return"skull of player"
An example implementation forExpression
s is to storeSkriptParser.ParseResult.expr
duringSyntaxElement.init(Expression[], int, Kleenean, SkriptParser.ParseResult)
and return that.
For other syntax types, this may vary. Effects, for example, may underline the whole line.- Returns:
- The text to underline in the line that produced a runtime error. This may be null if no highlighting is desired or possible.
-
error
Dispatches a runtime error with the given text. Metadata will be provided along with the message, including line number, the docs name of the producer, and the line content.
Implementations should ensure they call super() to print the error.- Parameters:
message
- The text to display as the error message.
-
warning
Dispatches a runtime warning with the given text. Metadata will be provided along with the message, including line number, the docs name of the producer, and the line content.
Implementations should ensure they call super() to print the warning.- Parameters:
message
- The text to display as the error message.
-
getRuntimeErrorManager
- Returns:
- The manager this producer will send errors to.
-