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 Type
    Method
    Description
    default void
    error(String message)
    Dispatches a runtime error with the given text.
    @NotNull ErrorSource
    Gets the source of the errors produced by the implementing class.
     
    @Nullable String
    Gets the text that should be underlined within the line contents.
    default void
    warning(String message)
    Dispatches a runtime warning with the given text.
  • Method Details

    • getErrorSource

      @Contract(" -> new") @NotNull @NotNull ErrorSource 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

      @Nullable @Nullable String 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 in give skull of player to all players throws a runtime error, this method should return "skull of player"
      An example implementation for Expressions is to store SkriptParser.ParseResult.expr during SyntaxElement.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

      default void error(String message)
      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

      default void warning(String message)
      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

      default RuntimeErrorManager getRuntimeErrorManager()
      Returns:
      The manager this producer will send errors to.