Class ParsingException

  • All Implemented Interfaces:
    java.io.Serializable

    @NonExtendable
    public abstract class ParsingException
    extends java.lang.RuntimeException
    An exception thrown when an error occurs while parsing a MiniMessage string.
    Since:
    4.10.0
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int LOCATION_UNKNOWN  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ParsingException​(@Nullable java.lang.String message)
      Create a new parsing exception with only a message.
      protected ParsingException​(@Nullable java.lang.String message, @Nullable java.lang.Throwable cause)
      Create a new parsing exception with a message and an optional cause.
      protected ParsingException​(java.lang.String message, java.lang.Throwable cause, boolean enableSuppression, boolean writableStackTrace)
      Create a new parsing exception with a message and an optional cause.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract @Nullable java.lang.String detailMessage()
      Get the detail message optionally passed with this exception.
      abstract int endIndex()
      Get the end index of the location which caused this exception.
      abstract @NotNull java.lang.String originalText()
      Get the input message which caused this exception.
      abstract int startIndex()
      Get the start index of the location which caused this exception.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ParsingException

        protected ParsingException​(@Nullable
                                   @Nullable java.lang.String message)
        Create a new parsing exception with only a message.
        Parameters:
        message - a detail message describing the error
        Since:
        4.10.0
      • ParsingException

        protected ParsingException​(@Nullable
                                   @Nullable java.lang.String message,
                                   @Nullable
                                   @Nullable java.lang.Throwable cause)
        Create a new parsing exception with a message and an optional cause.
        Parameters:
        message - a detail message describing the error
        cause - the cause
        Since:
        4.10.0
      • ParsingException

        protected ParsingException​(java.lang.String message,
                                   java.lang.Throwable cause,
                                   boolean enableSuppression,
                                   boolean writableStackTrace)
        Create a new parsing exception with a message and an optional cause.
        Parameters:
        message - a detail message describing the error
        cause - the cause
        enableSuppression - whether suppression is enabled or disabled
        writableStackTrace - whether the stack trace should be writable
        Since:
        4.13.0
    • Method Detail

      • originalText

        @NotNull
        public abstract @NotNull java.lang.String originalText()
        Get the input message which caused this exception.
        Returns:
        the original input message
        Since:
        4.10.0
      • detailMessage

        @Nullable
        public abstract @Nullable java.lang.String detailMessage()
        Get the detail message optionally passed with this exception.

        Unlike Throwable.getMessage(), this method does not include location information.

        Returns:
        the detail message passed to this exception
        Since:
        4.10.0
      • startIndex

        public abstract int startIndex()
        Get the start index of the location which caused this exception.

        This index is an index into originalText(). If location is unknown, LOCATION_UNKNOWN will be returned instead.

        Returns:
        the start index
        Since:
        4.10.0
      • endIndex

        public abstract int endIndex()
        Get the end index of the location which caused this exception.

        This index is an index into originalText(). If location is unknown, LOCATION_UNKNOWN will be returned instead.

        Returns:
        the end index
        Since:
        4.10.0