Class ValidationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
com.winterhavenmc.library.messagebuilder.validation.ValidationException
All Implemented Interfaces:
Serializable

public class ValidationException extends IllegalArgumentException
Thrown to indicate that a parameter validation has failed.

This exception supports localized error messages using the provided ErrorMessageKey and Parameter, and is typically thrown via static methods in Validator.

Unlike IllegalArgumentException, this class is designed specifically to support structured, translatable messages in a plugin context.

The message string is generated using Validator.formatMessage(ErrorMessageKey, Parameter), and may vary depending on the configured locale.

See Also:
  • Constructor Details

    • ValidationException

      public ValidationException(ErrorMessageKey errorMessageKey, Parameter parameter)
      Constructs a new ValidationException with the specified ErrorMessageKey and Parameter describing the failed validation.

      The exception message is immediately formatted using the current locale returned by ValidationContext.getLocale().

      Parameters:
      errorMessageKey - a structured key identifying the error message template
      parameter - the parameter that failed validation
  • Method Details

    • getMessage

      public String getMessage()
      Returns the localized message for this validation exception. The message is re-formatted on each call to reflect any changes in the active locale.
      Overrides:
      getMessage in class Throwable
      Returns:
      the localized validation error message