Class ConfigurationException

All Implemented Interfaces:
Serializable

public class ConfigurationException extends UltiToolsException
Exception thrown when configuration operations fail.

This includes configuration loading, parsing, saving, and validation errors.

Since:
6.2.0
Author:
wisdomme
See Also:
  • Constructor Details

    • ConfigurationException

      public ConfigurationException(String message)
      Creates a new configuration exception with the given message.
      Parameters:
      message - the error message
    • ConfigurationException

      public ConfigurationException(ErrorCode errorCode, String message)
      Creates a new configuration exception with a specific error code.
      Parameters:
      errorCode - the error code
      message - the error message
    • ConfigurationException

      public ConfigurationException(String message, Throwable cause)
      Creates a new configuration exception with message and cause.
      Parameters:
      message - the error message
      cause - the underlying cause
    • ConfigurationException

      public ConfigurationException(ErrorCode errorCode, String message, Throwable cause)
      Creates a new configuration exception with error code, message, and cause.
      Parameters:
      errorCode - the error code
      message - the error message
      cause - the underlying cause
  • Method Details

    • loadFailed

      public static ConfigurationException loadFailed(String configPath, Throwable cause)
      Creates an exception for configuration load failures.
      Parameters:
      configPath - the path to the configuration file
      cause - the underlying cause
      Returns:
      a new ConfigurationException
    • saveFailed

      public static ConfigurationException saveFailed(String configPath, Throwable cause)
      Creates an exception for configuration save failures.
      Parameters:
      configPath - the path to the configuration file
      cause - the underlying cause
      Returns:
      a new ConfigurationException
    • parseFailed

      public static ConfigurationException parseFailed(String configPath, Throwable cause)
      Creates an exception for configuration parse failures.
      Parameters:
      configPath - the path to the configuration file
      cause - the underlying cause
      Returns:
      a new ConfigurationException
    • validationFailed

      public static ConfigurationException validationFailed(String fieldName, String validationRule)
      Creates an exception for configuration validation failures.
      Parameters:
      fieldName - the name of the invalid field
      validationRule - the validation rule that was violated
      Returns:
      a new ConfigurationException
    • validationFailed

      public static ConfigurationException validationFailed(String moduleName, String configFilePath, List<String> violations)
      Creates an exception for a module refusing to load because one or more of its config fields violate their validation annotations (@Range, @NotEmpty, @Size, @Pattern).

      Per D-01, the operator's file is never rewritten - the module refuses to load instead. The message names the module, the file, and every violating field with its actual value and the constraint it broke, so the operator can fix it without guessing.

      Parameters:
      moduleName - the module refusing to load, from UltiToolsPlugin.getPluginName()
      configFilePath - the path of the violating configuration file
      violations - one description per violating field - field name, actual value, and the constraint it broke
      Returns:
      a new ConfigurationException
      Since:
      6.3.0
    • unconstructable

      public static ConfigurationException unconstructable(String className, Throwable cause)
      Creates an exception for a config class the framework cannot construct through either of its two supported idioms - a (String) constructor or an accessible no-arg constructor that hardcodes its path via super(path).
      Parameters:
      className - the fully-qualified name of the config class
      cause - the reflective failure that surfaced the missing constructor
      Returns:
      a new ConfigurationException
      Since:
      6.3.0