Class ConfigurationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.ultikits.ultitools.exceptions.UltiToolsException
com.ultikits.ultitools.exceptions.ConfigurationException
- All Implemented Interfaces:
Serializable
Exception thrown when configuration operations fail.
This includes configuration loading, parsing, saving, and validation errors.
- Since:
- 6.2.0
- Author:
- wisdomme
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurationException(ErrorCode errorCode, String message) Creates a new configuration exception with a specific error code.ConfigurationException(ErrorCode errorCode, String message, Throwable cause) Creates a new configuration exception with error code, message, and cause.ConfigurationException(String message) Creates a new configuration exception with the given message.ConfigurationException(String message, Throwable cause) Creates a new configuration exception with message and cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigurationExceptionloadFailed(String configPath, Throwable cause) Creates an exception for configuration load failures.static ConfigurationExceptionparseFailed(String configPath, Throwable cause) Creates an exception for configuration parse failures.static ConfigurationExceptionreloadValidationFailed(String moduleName, String configFilePath, List<String> violations) Creates the exception for a reload refused because one or more of the reloaded values violate their validation annotations (#595).static ConfigurationExceptionsaveFailed(String configPath, Throwable cause) Creates an exception for configuration save failures.static ConfigurationExceptionunconstructable(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 viasuper(path).static ConfigurationExceptionvalidationFailed(String fieldName, String validationRule) Creates an exception for configuration validation failures.static ConfigurationExceptionvalidationFailed(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).Methods inherited from class com.ultikits.ultitools.exceptions.UltiToolsException
getErrorCode, getFormattedMessage, toStringMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
ConfigurationException
Creates a new configuration exception with the given message.- Parameters:
message- the error message
-
ConfigurationException
Creates a new configuration exception with a specific error code.- Parameters:
errorCode- the error codemessage- the error message
-
ConfigurationException
Creates a new configuration exception with message and cause.- Parameters:
message- the error messagecause- the underlying cause
-
ConfigurationException
Creates a new configuration exception with error code, message, and cause.- Parameters:
errorCode- the error codemessage- the error messagecause- the underlying cause
-
-
Method Details
-
loadFailed
Creates an exception for configuration load failures.- Parameters:
configPath- the path to the configuration filecause- the underlying cause- Returns:
- a new ConfigurationException
-
saveFailed
Creates an exception for configuration save failures.- Parameters:
configPath- the path to the configuration filecause- the underlying cause- Returns:
- a new ConfigurationException
-
parseFailed
Creates an exception for configuration parse failures.- Parameters:
configPath- the path to the configuration filecause- the underlying cause- Returns:
- a new ConfigurationException
-
validationFailed
Creates an exception for configuration validation failures.- Parameters:
fieldName- the name of the invalid fieldvalidationRule- 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, fromUltiToolsPlugin.getPluginName()configFilePath- the path of the violating configuration fileviolations- one description per violating field - field name, actual value, and the constraint it broke- Returns:
- a new ConfigurationException
- Since:
- 6.3.0
-
reloadValidationFailed
public static ConfigurationException reloadValidationFailed(String moduleName, String configFilePath, List<String> violations) Creates the exception for a reload refused because one or more of the reloaded values violate their validation annotations (#595). UnlikevalidationFailed(String, String, List), the module is still running with its previous values, so the message says that fixing the file and reloading again is enough; no restart is needed.- Parameters:
moduleName- the module whose reload was refusedconfigFilePath- the path of the violating configuration fileviolations- one description per violating field - field name, actual value, and the constraint it broke- Returns:
- a new ConfigurationException
- Since:
- 6.3.0
-
unconstructable
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 viasuper(path).- Parameters:
className- the fully-qualified name of the config classcause- the reflective failure that surfaced the missing constructor- Returns:
- a new ConfigurationException
- Since:
- 6.3.0
-