Class IncorrectMobileException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.IncorrectMobileException
All Implemented Interfaces:
Serializable

public class IncorrectMobileException extends Exception
Checked exception thrown when an attempt is made to set or update a customer's mobile phone number with an invalid, malformed, or otherwise unacceptable value.

The mobile phone number in Customer must meet the application's validation requirements:

  • Must not be null, empty, or consist only of whitespace
  • Must contain a minimum number of digits (typically 9–15 depending on country)
  • May be required to follow international format (e.g., starting with '+')
  • Often validated using length, allowed characters, and basic pattern checks

Typical scenarios that trigger this exception:

  • User enters too few digits, includes letters, or uses incorrect formatting during registration
  • Calling Customer.setMobile(String) with an invalid value (e.g., "123", "+abc123", " ")
  • Admin tool or data import process attempting to assign a malformed phone number
  • Validation failure before persisting or updating customer contact information

This is a checked exception, requiring explicit handling or declaration. It represents an expected and recoverable validation error during user input — very common in registration, profile update, and checkout flows.

Since:
1.0
See Also:
  • Constructor Details

    • IncorrectMobileException

      public IncorrectMobileException(String message)
      Constructs a new incorrect-mobile exception with the specified detail message.
      Parameters:
      message - the detail message (e.g. "Invalid mobile phone number format") Saved for later retrieval by Throwable.getMessage()
    • IncorrectMobileException

      public IncorrectMobileException(String message, Throwable cause)
      Constructs a new incorrect-mobile exception with the specified detail message and cause.

      Useful when wrapping lower-level validation failures (e.g., regex mismatch, third-party phone validation library error, or constraint violation).

      Parameters:
      message - the detail message
      cause - the root cause of this exception
      Since:
      1.2