Class IncorrectEmailException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.IncorrectEmailException
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to set or update a customer's
email address with an invalid, malformed, or otherwise unacceptable value.
The email address in Customer must satisfy
strict validation rules:
- Must not be
null, empty, or whitespace-only - Must contain at least one
'@'symbol and a domain part - Must conform to common email format standards (e.g., local-part@domain.tld)
- Must be unique across all customers (enforced at DB level and in business logic)
Typical scenarios that trigger this exception:
- User enters an incorrectly formatted email during registration or profile update
- Calling
Customer.setEmail(String)with an invalid value (e.g., "user@", "user.domain", "user@.com") - Admin or data import tool attempting to assign a malformed email
- Validation failure before persisting a customer entity
This is a checked exception, forcing the caller to handle the invalid email explicitly. It represents a recoverable business/validation error that commonly occurs during user input — not a programming defect.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIncorrectEmailException(String message) Constructs a new incorrect-email exception with the specified detail message.IncorrectEmailException(String message, Throwable cause) Constructs a new incorrect-email exception with the specified detail message and cause. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
IncorrectEmailException
Constructs a new incorrect-email exception with the specified detail message.- Parameters:
message- the detail message (e.g. "Invalid or malformed email address") Saved for later retrieval byThrowable.getMessage()
-
IncorrectEmailException
Constructs a new incorrect-email exception with the specified detail message and cause.Useful when wrapping lower-level validation errors (e.g., regex failure, constraint violation, or third-party validation library exception).
- Parameters:
message- the detail messagecause- the root cause of this exception- Since:
- 1.2
-