Class ParsingException

  • All Implemented Interfaces:
    java.io.Serializable

    public class ParsingException
    extends ConfigurateException
    Indicates an error that occurred while parsing the configuration.

    These exceptions can include a specific position reference within a file.

    Since:
    4.0.0
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int UNKNOWN_POS
      Indicates a line or column is unknown.
    • Constructor Summary

      Constructors 
      Constructor Description
      ParsingException​(int line, int column, @Nullable java.lang.String context, @Nullable java.lang.String message, @Nullable java.lang.Throwable cause)
      Create a new parsing exception.
      ParsingException​(ConfigurationNode position, int line, int column, @Nullable java.lang.String context, @Nullable java.lang.String message, @Nullable java.lang.Throwable cause)
      Create a new parsing exception.
      ParsingException​(ConfigurationNode position, int line, int column, java.lang.String context, @Nullable java.lang.String message)
      Create a new parsing exception.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int column()
      Column most closely associated with the error.
      @Nullable java.lang.String context()
      A context line from the source, if available.
      @Nullable java.lang.String getMessage()
      Get a description of the location of this error, with path included.
      int line()
      Line most closely associated with this error.
      static ParsingException wrap​(ConfigurationNode source, java.io.IOException ex)
      Given an unknown IOException, return it as a Configurate type.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, 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

        public ParsingException​(ConfigurationNode position,
                                int line,
                                int column,
                                java.lang.String context,
                                @Nullable java.lang.String message)
        Create a new parsing exception.
        Parameters:
        position - position in the node structure where the error occurred
        line - line with issue
        column - column in the line
        context - the line in a file where the error occurred
        message - message describing the error
        Since:
        4.0.0
      • ParsingException

        public ParsingException​(int line,
                                int column,
                                @Nullable java.lang.String context,
                                @Nullable java.lang.String message,
                                @Nullable java.lang.Throwable cause)
        Create a new parsing exception.
        Parameters:
        line - line with issue
        column - column in the line
        context - the line in a file where the error occurred
        message - message describing the error
        cause - direct cause
        Since:
        4.0.0
      • ParsingException

        public ParsingException​(ConfigurationNode position,
                                int line,
                                int column,
                                @Nullable java.lang.String context,
                                @Nullable java.lang.String message,
                                @Nullable java.lang.Throwable cause)
        Create a new parsing exception.
        Parameters:
        position - position in the node structure where the error occurred
        line - line with issue
        column - column in the line
        context - the line in a file where the error occurred
        message - message describing the error
        cause - direct cause
        Since:
        4.0.0
    • Method Detail

      • wrap

        public static ParsingException wrap​(ConfigurationNode source,
                                            java.io.IOException ex)
        Given an unknown IOException, return it as a Configurate type.

        If the input ex is already a ParsingException, this method returns the input value.

        Parameters:
        source - node where the source exception was thrown
        ex - the source exception
        Returns:
        an exception, either casted or wrapped
        Since:
        4.0.0
      • line

        public int line()
        Line most closely associated with this error.
        Returns:
        line, or -1 for unknown
        Since:
        4.0.0
      • column

        public int column()
        Column most closely associated with the error.
        Returns:
        column, or -1 for unknown
        Since:
        4.0.0
      • context

        public @Nullable java.lang.String context()
        A context line from the source, if available.
        Returns:
        context line
        Since:
        4.0.0