Class ConfigurateException

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    ParsingException, SerializationException

    public class ConfigurateException
    extends java.io.IOException
    Any sort of error thrown within Configurate.

    Configurate's errors are designed to provide a view of as many errors as possible within one configuration tree, through the suppressed exceptions

    Since:
    4.0.0
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigurateException()
      Create a new unknown exception.
      ConfigurateException​(@Nullable java.lang.String message, @Nullable java.lang.Throwable cause)
      Create a new exception with informational message and cause.
      ConfigurateException​(java.lang.String message)
      Create a new exception at unknown path with provided informational message.
      ConfigurateException​(java.lang.Throwable cause)
      Create a new exception with a cause and unknown message.
      ConfigurateException​(ConfigurationNode pos, @Nullable java.lang.String message, @Nullable java.lang.Throwable cause)
      Create a new exception pre-initialized with path, message, and cause.
      ConfigurateException​(ConfigurationNode pos, java.lang.String message)
      Create a new exception pre-initialized with path and message.
      ConfigurateException​(ConfigurationNode pos, java.lang.Throwable cause)
      Create a new exception pre-initialized with path and cause.
      ConfigurateException​(NodePath path, @Nullable java.lang.String message, @Nullable java.lang.Throwable cause)
      Create a new exception pre-initialized with path, message, and cause.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @Nullable java.lang.String getMessage()
      Get a description of the location of this error, with path included.
      void initPath​(java.util.function.Supplier<NodePath> path)
      Initialize path if none has been set.
      NodePath path()
      Get the path associated with this failure.
      @Nullable java.lang.String rawMessage()
      Get the exception's message without any extra formatting.
      static ConfigurateException 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

      • ConfigurateException

        public ConfigurateException​(java.lang.String message)
        Create a new exception at unknown path with provided informational message.
        Parameters:
        message - informational message
        Since:
        4.0.0
      • ConfigurateException

        public ConfigurateException​(java.lang.Throwable cause)
        Create a new exception with a cause and unknown message.
        Parameters:
        cause - the cause of this exception
        Since:
        4.0.0
      • ConfigurateException

        public ConfigurateException​(@Nullable java.lang.String message,
                                    @Nullable java.lang.Throwable cause)
        Create a new exception with informational message and cause.
        Parameters:
        message - the informational message
        cause - the cause of the exception
        Since:
        4.0.0
      • ConfigurateException

        public ConfigurateException​(ConfigurationNode pos,
                                    java.lang.String message)
        Create a new exception pre-initialized with path and message.
        Parameters:
        pos - node where the error occurred
        message - message describing the error
        Since:
        4.0.0
      • ConfigurateException

        public ConfigurateException​(ConfigurationNode pos,
                                    java.lang.Throwable cause)
        Create a new exception pre-initialized with path and cause.
        Parameters:
        pos - node where the error occurred
        cause - direct cause of this exception
        Since:
        4.0.0
      • ConfigurateException

        public ConfigurateException​(ConfigurationNode pos,
                                    @Nullable java.lang.String message,
                                    @Nullable java.lang.Throwable cause)
        Create a new exception pre-initialized with path, message, and cause.
        Parameters:
        pos - node where the error occurred
        message - message describing the error
        cause - direct cause of this exception
        Since:
        4.0.0
      • ConfigurateException

        public ConfigurateException​(NodePath path,
                                    @Nullable java.lang.String message,
                                    @Nullable java.lang.Throwable cause)
        Create a new exception pre-initialized with path, message, and cause.
        Parameters:
        path - path to the node where the error occurred
        message - message describing the error
        cause - direct cause of this exception
        Since:
        4.0.0
    • Method Detail

      • wrap

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

        If the input ex is already a ConfigurateException, 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
      • path

        public NodePath path()
        Get the path associated with this failure.
        Returns:
        the path
        Since:
        4.0.0
      • initPath

        public void initPath​(java.util.function.Supplier<NodePath> path)
        Initialize path if none has been set.
        Parameters:
        path - new path
        Since:
        4.0.0
      • rawMessage

        public @Nullable java.lang.String rawMessage()
        Get the exception's message without any extra formatting.
        Returns:
        the raw message
        Since:
        4.0.0
      • getMessage

        public @Nullable java.lang.String getMessage()
        Get a description of the location of this error, with path included.
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        message
        Since:
        4.0.0